Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

229
Visualizações
Validation error while updating pages in notion by using the notion javascript SDK

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?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

After 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.com/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.com/docs/working-with-page-content#creating-a-page-with-content

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda