The text fields work fine but I get this error on the URL field:
body.properties.Website.id should be defined, instead was `undefined`.
body.properties.Website.name should be defined, instead was `undefined`.
body.properties.Website.start should be defined, instead was `undefined`.
This happens with any non-text field like checkboxes or relations too. I’ve checked my API token and database permissions multiple times.
It seems you’re encountering issues with how the properties are structured in your API call. For URL fields, you should define it as Website: { url: "https://www.example.com" } without using any arrays. Also, for Date properties, format it as Date: { date: { start: "2023-01-01" } } instead of using text content. Text fields like Title and Description are handled correctly with rich_text and arrays as you’ve implemented. I faced a similar challenge earlier when working with the API; precision in matching property types is crucial. Make sure to verify the property types in your Notion database to align your payload with those schemas. This adjustment should resolve the 400 errors you’re encountering.
your property structure’s wrong. for urls, just use Website: { url: "https://www.example.com" } - drop the arrays. same with dates: Date: { date: { start: "2023-01-01" } }. only rich text properties need that array format you’re using.
I experienced a similar issue recently, which was quite frustrating. The problem you are encountering stems from incorrect property formatting. For non-text fields, such as URLs, you should not wrap them in arrays or use text objects. Instead, define your Website property as Website: { url: "https://www.example.com" } - note the inclusion of the https protocol, which is crucial. Similarly, for date properties, use the format Date: { date: { start: "2023-01-01" } } to comply with the required ISO format. The error message about missing fields typically indicates that Notion expects specific property structures, but the text array format you are currently using doesn’t meet those expectations. Be sure to verify your database schema in Notion to ensure that your API payload reflects the accurate property types.