0

I'm trying to create a Notion page using API but keep getting error

body failed validation: body.parent should be defined, instead was undefined.

I'm using an edited version of actual cURL code snippet from the documentation. Clearly the parent is defined. Also GET and PATCH API requests seem to work fine, it's just POST that won't.

curl 'https://api.notion.com/v1/pages'   -H 'Authorization: Bearer secret_SECRET'   -H "Content-Type: application/json"   -H "Notion-Version: 2021-08-16"   --data '{
"parent": { "page_id": "PAGEID" }}'

(I removed the "properties" part from the request payload to simplify the snippet in question).

Ray Baxter
  • 3,181
  • 23
  • 27

2 Answers2

0

Okay, Seems to work now. My "properties" part of payload was bad but for whatever reason notion was giving out the error about "parent".

0

I had the same error; based on @JerryAn's comment on the other answer I added a Content-Type: application/json header to my POST request and it fixed the issue.

Jason Clark
  • 1,433
  • 1
  • 16
  • 24