I am submitting the following object with my request to notion.pages.create()
:
{
parent: {
type: 'database_id',
database_id: databaseID
},
properties: {
Name: {
title: [ {
type: 'text',
text: {
content: 'Expense1',
link: null
},
annotations: {
bold: false,
italic: false,
strikethrough: false,
underline: false,
code: false,
color: 'default'
},
plain_text: 'Expense1',
href: null
} ]
},
Date: { date: { start: '2023-06-23' } },
Amount: { number: 9.56 },
Subcategory: []
}
}
The Name is my title property, Date is a date, Amount is a dollar number, and Subcategory is a relation (Category is a rollup so I am omitting it in the request).
I get this error on my request:
"@notionhq/client warn: request fail {
code: 'validation_error',
message: 'body failed validation. Fix one:\n' +
'body.properties.Name.id should be defined, instead was `undefined`.\n' +
'body.properties.Name.name should be defined, instead was `undefined`.\n' +
'body.properties.Name.start should be defined, instead was `undefined`.'
}
This is confusing to me as it conflicts with the way that the API docs describe how to fill in each property type. Also, when I change the order of the properties, the same error comes up (for example, it says 'body.properties.Amount.id
should be defined...' instead of body.properties.Name
). Anyone have any insight?
I tried changing the order of the objects and checking over my syntax to match the API docs several times, but to no avail.