Notion Http-request: Error parsing JSON body

Describe the problem/error/question

The notion api doesn’t accept the json I send to update a file property (link external files).

I can edit other properties like checkboxes or text.

What is the error message (if any)?

ERROR: Bad request - please check your parameters

400 - “{"object":"error","status":400,"code":"invalid_json","message":"Error parsing JSON body."}” - {“object”:“error”,“status”:400,“code”:“invalid_json”,“message”:“Error parsing JSON body.”}

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: current
  • Database (default: SQLite): default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker
  • Operating system: Ubuntu

Hey @atwork1,

It looks like the JSON that is being sent is not being correctly converted, I did a quick test by sending the data to webhook.site but there are other tools to do this. To fix the issue try changing your Body in the HTTP Request node to…

{
"properties": {
  

"Protokolle": {
    "files": {{ JSON.stringify($json["images"].files) }}
 }
}
}
1 Like

like magic :raised_hands:
Thank you !

Btw. if you have trouble getting it to work. There’s an issue with the sample data.
The notion API won’t create two separate file links if the urls are identical.
In this case it will only create the first one.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.