Trying to make a post request to Notion to create a new page. Receiving an Error 400 Bad Request and can’t find the issue.
Here’s the documentation - Create a page
and script below
let payload = {
'parent': {
"type": "page_id",
"page_id": "my page id"
},
'properties': {
"Name": {
"type": "title",
"title": [{ "type": "text", "text": { "content": "My Page Title" } }]
}
}
};
let response = await remoteFetchAsync(postUrl, {
method: 'POST',
body: JSON.stringify(payload),
headers: {
'Notion-Version': '2022-06-28',
'Content-Type': 'application/json',
'Authorization': `Bearer ${apiKey}`,
},
});
output.text('**POST RESPONSE**' + ' - ' + response.status)