1

While using the newest updated notion API version, I encountered an odd problem. I retrieved data from the designated Notion database by following the steps provided on the Notion API website. And the requested JOSN data included correct column names and a correct number of occurrences. However, the values for each entry were all the same, composited by weird symbols. I have been using Notion API for years; this is the first time this has happened with the updated version. So I am baffled.

The code for data retrieval:

import requests
database_id = '************************************'
token_key = '************************************'
url = f"https://api.notion.com/v1/databases/{database_id}/query"

payload = {
    "page_size": 100
}
headers = {
    "Accept": "application/json",
    "Notion-Version": "2022-06-28",
    "Content-Type": "application/json",
    "Authorization": f"Bearer {token_key}"
}

response = requests.post(url, headers=headers)
data = response.json()

When I ran data['resutlts'][0]['properties'] (properties of the first element/row of the database), I got something as follows.

{'Created': {'id': '%3ExKj'},
 'Count': {'id': 'Vdcv'},
 'Conscious': {'id': '%60mnq'},
 'Last_Edited': {'id': '%60w%40T'},
 'Source': {'id': 'c%3FC~'},
 'Confidence Level': {'id': 'cfwz'},
 'Context': {'id': 'nX%3A%60'},
 'Next': {'id': 'zIoO'},
 'Vocab': {'id': 'title'}}

As shown above, the ids for each variable are deprecated, and not sure what they represent. I initially thought it had to do with Unicode but couldn't figure out how to adjust it to get the desired outcome. If anyone has an idea how to solve this issue, please let me know. Thank you!

Andy Lee
  • 43
  • 4

0 Answers0