Franco Moyano
Franco Moyano

Reputation: 11

How can I select a Relation in my table when entering data using Notion API?

I am trying to send a POST through the Notion API to add a line into one of my tables. The "Product" column, however, is a relation, and I have no idea how to select the relation "Cup" when sending the POST.

{
    "parent": {
        "database_id": "ejn389ene83h8he89h3hi"
    },
    "properties": {
        "Export ID": {
            "title": [
                {
                    "text": {
                        "content": "ITEM 1"
                    }
                }
            ]
        },

        "Products": {
            "type": "relation",
            "relation": "Cup"
        },

        "Quantity": {
            "type": "number",
            "number": 1
        },

        "Reason": {
            "type": "select",
            "select": {
                "name": "For Order"
            }
        }
    }
}

I've tried searching online for more info on how to format relations when sending a POST via the Notion API but there's nothing. Nothing I can easily grasp at least. I've tried other people's code but I ended up getting no where. If I take out the "Products" section of my POST script, it works, except it doesn't set any value for the "Products" column of my table.

Upvotes: 0

Views: 48

Answers (0)

Related Questions