# API Issue: Help with connecting to Notion database

**URL:** <https://community.thunkable.com/t/api-issue-help-with-connecting-to-notion-database/3225706>\
**Category:** Questions about Thunkable X\
**Created:** [September 25, 2024, 1:57am UTC](https://community.thunkable.com/t/api-issue-help-with-connecting-to-notion-database/3225706 "2024-09-25T01:57:06Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![joemoukarzel88skm4pi](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/joemoukarzel88skm4pi/32/185210_2.png) [@joemoukarzel88skm4pi](https://community.thunkable.com/u/joemoukarzel88skm4pi)\
**Post date:** [September 25, 2024, 1:57am UTC](https://community.thunkable.com/t/api-issue-help-with-connecting-to-notion-database/3225706/1 "2024-09-25T01:57:07Z")

</div>

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?

 ![Notion API](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/8/28ec564e19611f9b6a3245891ff1e63890e817fd.jpeg)

---

<div class="post-metadata">

**Author:** ![joemoukarzel88skm4pi](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/joemoukarzel88skm4pi/32/185210_2.png) [@joemoukarzel88skm4pi](https://community.thunkable.com/u/joemoukarzel88skm4pi)\
**Post date:** [September 25, 2024, 2:49am UTC](https://community.thunkable.com/t/api-issue-help-with-connecting-to-notion-database/3225706/2 "2024-09-25T02:49:33Z")

</div>

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

 ![Screenshot 2024-09-25 124744](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/8/d8c29153b0cf3060c45a49806a2498569f455566.png)

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

 ![x](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/8/48525c468d355c8262154d3729ed156726ab568d.png)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [September 25, 2024, 3:37am UTC](https://community.thunkable.com/t/api-issue-help-with-connecting-to-notion-database/3225706/3 "2024-09-25T03:37:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![joemoukarzel88skm4pi](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/joemoukarzel88skm4pi/32/185210_2.png) [@joemoukarzel88skm4pi](https://community.thunkable.com/u/joemoukarzel88skm4pi)\
**Post date:** [September 25, 2024, 3:48am UTC](https://community.thunkable.com/t/api-issue-help-with-connecting-to-notion-database/3225706/4 "2024-09-25T03:48:28Z")

</div>

Thank you so much!

```auto
{
    "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.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [September 25, 2024, 1:55pm UTC](https://community.thunkable.com/t/api-issue-help-with-connecting-to-notion-database/3225706/5 "2024-09-25T13:55:21Z")

</div>

Using [Best JSON Viewer and JSON Beautifier Online](https://codebeautify.org/jsonviewer), the path to the “content” property is shown at the top when I paste in your JSON text and click on that property:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/e/ce1480ddd12144db9d23e57f4bb0bba3b22b9192.png)

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:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/c/ace78c498b43672273db3536472c72ad3d14d2da.png)

---

<div class="post-metadata">

**Author:** ![joemoukarzel88skm4pi](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/joemoukarzel88skm4pi/32/185210_2.png) [@joemoukarzel88skm4pi](https://community.thunkable.com/u/joemoukarzel88skm4pi)\
**Post date:** [September 25, 2024, 2:10pm UTC](https://community.thunkable.com/t/api-issue-help-with-connecting-to-notion-database/3225706/6 "2024-09-25T14:10:16Z")

</div>

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.**

 ![sol](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/9/891a839c8ac9b97191980088215c00b0388c2b51.png)  
This format worked, the trick was to use **POST** instead of **GET**

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [December 24, 2024, 2:10pm UTC](https://community.thunkable.com/t/api-issue-help-with-connecting-to-notion-database/3225706/7 "2024-12-24T14:10:27Z")

</div>

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