Going through the Notion API docs, it mentions the text configuration is same as rich-text-object.
In the response for my page, I view the text property as -
{
"object": "page",
"id": "123",
"created_time": "2021-02-18T15:12:00.000Z",
"last_edited_time": "2021-05-15T12:37:30.830Z",
"parent": {
"type": "database_id",
"database_id": "456"
},
"archived": false,
"properties": {
"Highlights": {
"id": "jCaG",
"type": "text",
"text": [
{
"type": "text",
"text": {
"content": "test 1\ntest 2",
"link": null
},
"annotations": {
"bold": false,
"italic": false,
"strikethrough": false,
"underline": false,
"code": false,
"color": "default"
},
"plain_text": "test 1\ntest 2",
"href": null
}
]
}
}
My question is, if the text
property takes an array, can we add multiple text objects to it?
I tried to do the same with the PATCH
request to the update page record, but the response was not as expected, it switched all the annotations to true
, ie. bold, italic, underline, strike-through and code blocks all were true, even though they weren't in the initial request.
Here, is the JSON I sent in my PATCH
call -
{
"object": "page",
"id": "123",
"created_time": "2021-02-18T15:12:00.000Z",
"last_edited_time": "2021-05-15T12:09:00.000Z",
"parent": {
"type": "database_id",
"database_id": "456"
},
"archived": false,
"properties": {
"Highlights": {
"id": "jCaG",
"type": "text",
"text": [
{
"type": "text",
"text": {
"content": "test 1\ntest 2",
"link": null
},
"annotations": {
"bold": false,
"italic": false,
"strikethrough": false,
"underline": false,
"code": false,
"color": "default"
},
"plain_text": "test 1\ntest 2",
"href": null
},
{
"type": "text",
"text": {
"content": "test 3",
"link": null
},
"annotations": {
"bold": false,
"italic": false,
"strikethrough": false,
"underline": false,
"code": false,
"color": "default"
},
"plain_text": "test 3",
"href": null
}
]
}
}
And the response from the same was -
{
"object": "page",
"id": "123",
"created_time": "2021-02-18T15:12:00.000Z",
"last_edited_time": "2021-05-15T12:37:30.830Z",
"parent": {
"type": "database_id",
"database_id": "456"
},
"archived": false,
"properties": {
"Highlights": {
"id": "jCaG",
"type": "text",
"text": [
{
"type": "text",
"text": {
"content": "test 1\ntest 2",
"link": null
},
"annotations": {
"bold": true,
"italic": true,
"strikethrough": true,
"underline": true,
"code": true,
"color": "default"
},
"plain_text": "test 1\ntest 2",
"href": null
},
{
"type": "text",
"text": {
"content": "test 3",
"link": null
},
"annotations": {
"bold": true,
"italic": true,
"strikethrough": true,
"underline": true,
"code": true,
"color": "default"
},
"plain_text": "test 3",
"href": null
}
]
}
}
Has anyone here experimented with the text property, if yes, can you please guide me through the same?
Thanks.