小编Mur*_*rti的帖子

使用notion javascript SDK更新notion中的页面时出现验证错误

这是错误:

客户端警告:请求失败{代码:'validation_error',消息:'正文验证失败。修复一:应该定义 body.properties.body.id,而不是undefined。body.properties.body.name 应该被定义,而不是undefined。body.properties.body.start 应该被定义,而不是undefined。' 主体验证失败。修复一:应该定义 body.properties.body.id,而不是undefined。body.properties.body.name 应该被定义,而不是undefined。body.properties.body.start 应该被定义,而不是undefined

这是我的代码:

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(); …
Run Code Online (Sandbox Code Playgroud)

javascript notion-api

5
推荐指数
1
解决办法
8647
查看次数

标签 统计

javascript ×1

notion-api ×1