API Issue: Help with connecting to Notion database

Hi,
I’m trying to get data from a Notion database.
I have been able to query the database in Thunkable and get all the values, so the API is definitely working.
The way Notion indexes the database is like this:
Customer 1 Name: results[0].properties.Name.title[0].text.content
Customer 2 Name: results[1].properties.Name.title[0].text.content
Customer 3 Name: results[2].properties.Name.title[0].text.content
etc.

I haven’t been able to get a single value to show, always returning: Null

What am I possibly doing incorrectly?

Just watch Tatiang’s youtube video and tried to format it this way. I was sure it was going to work but it returns: undefined

EDIT: I realised i did this the wrong way around. Still not working though

1 Like

The best thing to do is to post the value of the green response block (assign it to a text input’s text so you can copy and paste it) as text. Make sure to format it using the </> button in the forums toolbar. I can help you fix the properties once you do that.

1 Like

Thank you so much!

{
    "object": "list",
    "results": [{
        "object": "page",
        "id": "48c6396c-511d-4153-b21e-ae24e4539975",
        "created_time": "2024-09-02T06:25:00.000Z",
        "last_edited_time": "2024-09-02T06:27:00.000Z",
        "created_by": {
            "object": "user",
            "id": "7b6aa778-199b-4934-ac6a-8836cddf4e56"
        },
        "last_edited_by": {
            "object": "user",
            "id": "7b6aa778-199b-4934-ac6a-8836cddf4e56"
        },
        "cover": null,
        "icon": null,
        "parent": {
            "type": "database_id",
            "database_id": "f984546d-7319-403d-a9c9-53e5f3095ee2"
        },
        "archived": false,
        "in_trash": false,
        "properties": {
            "Photo": {
                "id": "%3CAi%3E",
                "type": "files",
                "files": []
            },
            "Email Address": {
                "id": "As%60t",
                "type": "email",
                "email": null
            },
            "Consent": {
                "id": "Ay%7C%5D",
                "type": "checkbox",
                "checkbox": false
            },
            "⏰ Appointment Scheduler": {
                "id": "B%7CpL",
                "type": "relation",
                "relation": [],
                "has_more": false
            },
            "Phone Number": {
                "id": "Ed%5Bd",
                "type": "phone_number",
                "phone_number": null
            },
            "Appt Status": {
                "id": "LCkr",
                "type": "rollup",
                "rollup": {
                    "type": "array",
                    "array": [],
                    "function": "show_original"
                }
            },
            "Tag": {
                "id": "V%3FNa",
                "type": "multi_select",
                "multi_select": [{
                    "id": "efee7675-f920-4952-a6c2-c2c0f79fde5d",
                    "name": "Registrar",
                    "color": "yellow"
                }]
            },
            "Person Type": {
                "id": "XEUg",
                "type": "multi_select",
                "multi_select": [{
                    "id": "e9779d71-124b-47fb-bef4-7395bb8edf0f",
                    "name": "Doctor",
                    "color": "red"
                }]
            },
            "Specialty ": {
                "id": "%5Bnrd",
                "type": "multi_select",
                "multi_select": [{
                    "id": "TViY",
                    "name": "Psychiatry",
                    "color": "red"
                }]
            },
            "RX Tier": {
                "id": "%5CAci",
                "type": "select",
                "select": null
            },
            "Property": {
                "id": "dgca",
                "type": "rich_text",
                "rich_text": [{
                    "type": "text",
                    "text": {
                        "content": "OOHC/WFT Ingleburn C&A",
                        "link": null
                    },
                    "annotations": {
                        "bold": false,
                        "italic": false,
                        "strikethrough": false,
                        "underline": false,
                        "code": false,
                        "color": "default"
                    },
                    "plain_text": "OOHC/WFT Ingleburn C&A",
                    "href": null
                }]
            },
            "Next Appt": {
                "id": "k_Rm",
                "type": "rollup",
                "rollup": {
                    "type": "array",
                    "array": [],
                    "function": "show_original"
                }
            },
            "AM Tier": {
                "id": "vBdZ",
                "type": "select",
                "select": null
            },
            "Last Seen": {
                "id": "vq%7Bp",
                "type": "date",
                "date": {
                    "start": "2024-08-16",
                    "end": null,
                    "time_zone": null
                }
            },
            "Primary Parent": {
                "id": "v%7B%60%5E",
                "type": "rich_text",
                "rich_text": []
            },
            "Name": {
                "id": "title",
                "type": "title",
                "title": [{
                    "type": "text",
                    "text": {
                        "content": "Donnet, Cameron",
                        "link": null
                    },
                    "annotations": {
                        "bold": false,
                        "italic": false,
                        "strikethrough": false,
                        "underline": false,
                        "code": false,
                        "color": "default"
                    },
                    "plain_text": "Donnet, Cameron",
                    "href": null
                }]
            }
        },
        "url": "https://www.notion.so/Donnet-Cameron-48c6396c511d4153b21eae24e4539975",
        "public_url": null
    }, {
        "object": "page",
        "id": "6161fdab-fb47-4f20-b9f4-c3f30d9ced17",
        "created_time": "2024-09-02T06:23:00.000Z",
        "last_edited_time": "2024-09-02T06:24:00.000Z",
        "created_by": {
            "object": "user",
            "id": "7b6aa778-199b-4934-ac6a-8836cddf4e56"
        },
        "last_edited_by": {
            "object": "user",
            "id": "7b6aa778-199b-4934-ac6a-8836cddf4e56"
        },
        "cover": null,
        "icon": null,
        "parent": {
            "type": "database_id",
            "database_id": "f984546d-7319-403d-a9c9-53e5f3095ee2"
        },
        "archived": false,
        "in_trash": false,
        "properties": {
            "Photo": {
                "id": "%3CAi%3E",
                "type": "files",
                "files": []
            },
            "Email Address": {
                "id": "As%60t",
                "type": "email",
                "email": null
            },
            "Consent": {
                "id": "Ay%7C%5D",
                "type": "checkbox",
                "checkbox": false
            },
            "⏰ Appointment Scheduler": {
                "id": "B%7CpL",
                "type": "relation",
                "relation": [],
                "has_more": false
            },
            "Phone Number": {
                "id": "Ed%5Bd",
                "type": "phone_number",
                "phone_number": null
            },
            "Appt Status": {
                "id": "LCkr",
                "type": "rollup",
                "rollup": {
                    "type": "array",
                    "array": [],
                    "function": "show_original"
                }
            },
            "Tag": {
                "id": "V%3FNa",
                "type": "multi_select",
                "multi_select": [{
                    "id": "efee7675-f920-4952-a6c2-c2c0f79fde5d",
                    "name": "Registrar",
                    "color": "yellow"
                }]
            },
            "Person Type": {
                "id": "XEUg",
                "type": "multi_select",
                "multi_select": [{
                    "id": "e9779d71-124b-47fb-bef4-7395bb8edf0f",
                    "name": "Doctor",
                    "color": "red"
                }]
            },
            "Specialty ": {
                "id": "%5Bnrd",
                "type": "multi_select",
                "multi_select": [{
                    "id": "TViY",
                    "name": "Psychiatry",
                    "color": "red"
                }]
            },
            "RX Tier": {
                "id": "%5CAci",
                "type": "select",
                "select": null
            },
            "Property": {
                "id": "dgca",
                "type": "rich_text",
                "rich_text": [{
                    "type": "mention",
                    "mention": {
                        "type": "page",
                        "page": {
                            "id": "3ccc4bd1-7285-438a-a847-a6bda3b2d40b"
                        }
                    },
                    "annotations": {
                        "bold": false,
                        "italic": false,
                        "strikethrough": false,
                        "underline": false,
                        "code": false,
                        "color": "default"
                    },
                    "plain_text": "Campbelltown Hospital",
                    "href": "https://www.notion.so/3ccc4bd17285438aa847a6bda3b2d40b"
                }, {
                    "type": "text",
                    "text": {
                        "content": " ",
                        "link": null
                    },
                    "annotations": {
                        "bold": false,
                        "italic": false,
                        "strikethrough": false,
                        "underline": false,
                        "code": false,
                        "color": "default"
                    },
                    "plain_text": " ",
                    "href": null
                }]
            },
            "Next Appt": {
                "id": "k_Rm",
                "type": "rollup",
                "rollup": {
                    "type": "array",
                    "array": [],
                    "function": "show_original"
                }
            },
            "AM Tier": {
                "id": "vBdZ",
                "type": "select",
                "select": null
            },
            "Last Seen": {
                "id": "vq%7Bp",
                "type": "date",
                "date": {
                    "start": "2024-08-16",
                    "end": null,
                    "time_zone": null
                }
            },
            "Primary Parent": {
                "id": "v%7B%60%5E",
                "type": "rich_text",
                "rich_text": []
            },
            "Name": {
                "id": "title",
                "type": "title",
                "title": [{
                    "type": "text",
                    "text": {
                        "content": "Islam, Nabilah",
                        "link": null
                    },
                    "annotations": {
                        "bold": false,
                        "italic": false,
                        "strikethrough": false,
                        "underline": false,
                        "code": false,
                        "color": "default"
                    },
                    "plain_text": "Islam, Nabilah",
                    "href": null
                }]
            }
        },
        "url": "https://www.notion.so/Islam-Nabilah-6161fdabfb474f20b9f4c3f30d9ced17",
        "public_url": null
    }],
    "next_cursor": "7ef3586e-a4d5-4971-a344-260405847718",
    "has_more": true,
    "type": "page_or_database",
    "page_or_database": {},
    "request_id": "bd9ad48c-4bc0-469c-acbe-d0d578295bca"
}

That’s only two entries but the information is sensitive so i didn’t post the whole database.

Using Best JSON Viewer and JSON Beautifier Online, the path to the “content” property is shown at the top when I paste in your JSON text and click on that property:

So I would get the property “results[1].properties.Name.title[1].text.content” of the JSON object to retrieve that value. JSON arrays start at index 0 but Thunkable lists start at index 1 so that’s why we use 1 instead of 0:

1 Like

Thanks for that. I later realized I should have used the index of [1]. It’s still not working unfortunately - still returning null
EDIT: It did work! I tested it on the web viewer initially and that returned null, but on the phone live test it works.


This format worked, the trick was to use POST instead of GET

2 Likes