Notion API expects certain formatting for expressing blocks into pages via API. Here, we document the syntax for various types of R blocks. Notably, there are several sections of this API call body.

Parent

Properties

Children

The children section is an array of objects. Each object being a block of some sort. In general, the format of a single block is shown below - code on the left and

JSON

{
  "object": "block",
  "type": "heading_1",
  "heading_1": {
    "rich_text": [
      {
        "type": "text",
       "text": {
          "content": "Raw Code"
        }
      }
    ]
  }
}

Checklist

Here, we go through some examples of some blocks we have utilized the API to express.

Headings

This is pretty simple, just follow the formating below to define your content.

JSON

{
  "object": "block",
  "type": "heading_1",
  "heading_1": {
    "rich_text": [
      {
        "type": "text",
        "text": {
          "content": "Raw Code"
        }
      }
    ]
  }
}

Breakdown

Code

JSON

   {  
     "object": "block",
     "type": "code",
     "code": {
       "rich_text": [
         {
           "type": "text",
           "text": {
             "content": "SELECT *    FROM read_parquet(\\'external_seed/seed.parquet\\')"
           }
         }
       ],
       "language": "sql"
     }
   }

Breakdown