0

This is my first post so please bear with me. I am trying to insert data into a notion database. The database ID I already know. I am trying to pass a task and the text as "To Do" for a Select property titled "Kanban Status". Essentially being able to pass tasks into Notion.

Can you please tell me where I am going wrong in the below? I am getting the error -

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

The code is below -

{

"parent": { "type": "database_id", "database_id":"xyz"},

    properties: {

    "Task": {
        "type": "title",
        "title": [{ "type": "text", "text": { "content": "testing API" } }]
    }
    "Kanban status": {
        "rich_text": "text",
        "text": [{"type": "text", "text": { "content": "To Do"} }]
    }

    }
}

Thank you

Jerry


Update - Thanks to Espen for correcting a few mistakes. Now I'm seeing the below error. Any advise?

{"status":400,"object":"error","code":"validation_error","message":"body failed validation. Fix one:\nbody.properties.Kanban status.title should be defined, instead was undefined.\nbody.properties.Kanban status.rich_text should be an array, instead was \"text\".\nbody.properties.Kanban status.number should be defined, instead was undefined.\nbody.properties.Kanban status.url should be defined, instead was undefined.\nbody.properties.Kanban status.select should be defined, instead was undefined.\nbody.properties.Kanban status.multi_select should be defined, instead was undefined.\nbody.properties.Kanban status.people should be defined, instead was undefined.\nbody.properties.Kanban status.email should be defined, instead was undefined.\nbody.properties.Kanban status.phone_number should be defined, instead was undefined.\nbody.properties.Kanban status.date should be defined, instead was undefined.\nbody.properties.Kanban status.checkbox should be defined, instead was undefined.\nbody.properties.Kanban status.relation should be defined, instead was undefined.\nbody.properties.Kanban status.files should be defined, instead was undefined.\nbody.properties.Task.id should be defined, instead was undefined.\nbody.properties.Task.name should be defined, instead was undefined.\nbody.properties.Task.start should be defined, instead was undefined."}

CuriousMe
  • 1
  • 3

2 Answers2

0

You must put quotes around properties and a comma before "Kanban status".

{    
"parent": { "type": "database_id", "database_id":"xyz"},

    "properties": {

    "Task": {
        "type": "title",
        "title": [{ "type": "text", "text": { "content": "testing API" } }]
    },
    "Kanban status": {
        "rich_text": "text",
        "text": [{"type": "text", "text": { "content": "To Do"} }]
    }

    }
}
Espen Burud
  • 1,871
  • 10
  • 9
0

Solved my own problem. See below what I had to fix.

"Kanban Status": {
    "select": {
        "name": "To Do"
    }
}
CuriousMe
  • 1
  • 3