I've tried to create Scriptable widget using Notion API.
I need to get count of page inside DB.
So, I used guide to create token and share DB, and by this guide I create cURL request:
  curl 'https://api.notion.com/v1/databases/%DB_ID%/query' \
  -H 'Authorization: Bearer %TOKEN%' \
  -H 'Notion-Version: 2021-05-13' \
  --data '{
      "filter": 
            {
            }
        }'
The filter in body is required, without this param you will get error.
So, the curl works fine.
Then I've tried to create scriptable code:
async function notion_fetchData() {
  const url = 'https://api.notion.com/v1/databases/%DB_ID%/query'
  request = new Request(url)
  request.headers = {'Authorization':Bearer ${todoist_Api_key}, 'Notion-Version': '2021-05-13'}
  request.body = Data.fromString('{"filter": {}}')
  const res_notion = await request.loadJSON()
  console.log(res_notion)
  return res_notion
}
And this code gets error: "resource exceeds maximum size". Any ideas how to debug this error?