admin管理员组文章数量:1317909
Here's the error:
Client warn: request fail {
code: 'validation_error',
message: 'body failed validation. Fix one: body.properties.body.id should be defined, instead was undefined
.
body.properties.body.name should be defined, instead was undefined
. body.properties.body.start should be defined, instead was undefined
.'
}
body failed validation. Fix one: body.properties.body.id should be defined, instead was undefined
. body.properties.body.name should be defined, instead was undefined
. body.properties.body.start should be defined, instead was undefined
Here's my code :
async function update() {
const res_2 = await notion.databases.query({ database_id: `${databaseId}` });
res_2.results.forEach(async (page, index) => {
let property_id = page.properties.Excerpt.id;
if (index === 0) {
try {
const res_3 = await notion.pages.update({
page_id: page.id,
properties: {
[property_id]: {
type: "rich_text",
rich_text: {
"content": "hey"
}
}
}
})
} catch (err) {
console.log(err.message)
}
}
})
}
update();
I am not getting why there is a body validation error and from where it originated. Any fixes?
Here's the error:
Client warn: request fail {
code: 'validation_error',
message: 'body failed validation. Fix one: body.properties.body.id should be defined, instead was undefined
.
body.properties.body.name should be defined, instead was undefined
. body.properties.body.start should be defined, instead was undefined
.'
}
body failed validation. Fix one: body.properties.body.id should be defined, instead was undefined
. body.properties.body.name should be defined, instead was undefined
. body.properties.body.start should be defined, instead was undefined
Here's my code :
async function update() {
const res_2 = await notion.databases.query({ database_id: `${databaseId}` });
res_2.results.forEach(async (page, index) => {
let property_id = page.properties.Excerpt.id;
if (index === 0) {
try {
const res_3 = await notion.pages.update({
page_id: page.id,
properties: {
[property_id]: {
type: "rich_text",
rich_text: {
"content": "hey"
}
}
}
})
} catch (err) {
console.log(err.message)
}
}
})
}
update();
I am not getting why there is a body validation error and from where it originated. Any fixes?
Share Improve this question edited Jan 7, 2022 at 10:24 Murtuzaali Surti asked Jan 7, 2022 at 10:01 Murtuzaali SurtiMurtuzaali Surti 2711 gold badge2 silver badges12 bronze badges1 Answer
Reset to default 6After a little bit of digging, I found out that this error generally occurs when there are missing parameters in the request body. As per the official Notion documentation,
The request body does not match the schema for the expected parameters. Check the "message" property for more details. https://developers.notion./reference/errors
I did not construct the object correctly, and that's why I was getting this error.
The correct construction of rich_text_object
is as follows:
properties: {
"Excerpt": {
"rich_text": [
{
"type": "text",
"text": {
"content": "hello"
}
}
]
}
}
You can find more information here : https://developers.notion./docs/working-with-page-content#creating-a-page-with-content
本文标签: Validation error while updating pages in notion by using the notion javascript SDKStack Overflow
版权声明:本文标题:Validation error while updating pages in notion by using the notion javascript SDK - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742027689a2415854.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论