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.
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
object
- Object type is blocktype
- is the type of block you want to insert for example code or heading_1{type}
- we set configurations or details of the type of block we want to insert. Each type of block will have its details so please refers to our glossary or the Notion API docs for details.Here, we go through some examples of some blocks we have utilized the API to express.
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
JSON
{
"object": "block",
"type": "code",
"code": {
"rich_text": [
{
"type": "text",
"text": {
"content": "SELECT * FROM read_parquet(\\'external_seed/seed.parquet\\')"
}
}
],
"language": "sql"
}
}
Breakdown