Open PaoloConte opened 9 months ago
Hello! @seratch I was wondering if I could contribute with this issue.
But while I was checking out if I could get a grasp of this, I have found some strange behaviours in append block children api.
If a table is appended as a child in append block children,
and has a "id" created by UUID.randomUUID().toString(),
it results in a error of
{"object":"error","status":400,"code":"validation_error","message":"Content creation Failed. Fix the following: \nTable block must have a table width >= 1\nParent table block must have a table width >= 1","request_id":"5858d1aa-6fa2-423c-acf0-f4466d14bda7"}
even if it has "table_width": 1 specified.
This is strange because all the requests "id" value was created on constructor by UUID.randomUUID() before going in gson.
not_working.sh
NOTION_TOKEN=;
NOTION_TEST_PAGE_ID=;
curl -X PATCH "https://api.notion.com/v1/blocks/${NOTION_TEST_PAGE_ID}/children" \
-H "Authorization: Bearer ${NOTION_TOKEN}" \
-H "Content-Type: application/json" \
-H "Notion-Version: 2022-06-28" \
--data '{
"children": [
{
"object": "block",
"type": "table",
"id":"00de4d4d-12e8-41ff-b3b1-aa3d6d079493",
"table": {
"table_width": 1,
"has_column_header": false,
"has_row_header": false,
"children": [
{
"type": "table_row",
"table_row": {
"cells": [
[
{
"type": "text",
"text": {
"content": "One"
}
}
]
]
}
}
]
}
}
]
}'
working.sh
NOTION_TOKEN=;
NOTION_TEST_PAGE_ID=;
curl -X PATCH "https://api.notion.com/v1/blocks/${NOTION_TEST_PAGE_ID}/children" \
-H "Authorization: Bearer ${NOTION_TOKEN}" \
-H "Content-Type: application/json" \
-H "Notion-Version: 2022-06-28" \
--data '{
"children": [
{
"object": "block",
"type": "table",
"table": {
"table_width": 1,
"has_column_header": false,
"has_row_header": false,
"children": [
{
"type": "table_row",
"table_row": {
"cells": [
[
{
"type": "text",
"text": {
"content": "One"
}
}
]
]
}
}
]
}
}
]
}'
sorry if your team is already working on this issue and I just alerted you again. XD Just thought it was good for you to know.
@dohyung97022 Thanks for letting me know. I don't have the bandwidth to work on this task right now but when this project add this support, it may need to do some workarounds to deal with the server-side behavior.
Hello, even though the Notion API is not very clear about it, the TableBlock.Element object should have a property named
children
of typeList<TableRowBlock>
.This is an example of a working API request for the endpoint Append block children