0

I have the next query to notion.

    curl -X POST 'https://api.notion.com/v1/databases/%DB_ID%/query'\
    -H 'Authorization: Bearer %SECRET%'   \
    -H 'Notion-Version: 2021-05-13'   \
    --data '{
            "filter":{}
            ,"start_cursor" : "%NEXT_CURSOR_FROM_PREV_REQUEST%"    
    }' > notion_db2.json

But result contains result of first request (my db contains more than 100 pages)

How should I rewrite my request?

Sanek Zhitnik
  • 716
  • 1
  • 10
  • 25

2 Answers2

2

You're just missing the following header:

-H "Content-Type: application/json" \

Your current request misses the body part all together!

bbbingus
  • 36
  • 2
0

I tried your code in a Python program I wrote, and I get an HTTP 400 error response.

I removed the empty filter parameter, and it worked.

Try this:

curl -X POST 'https://api.notion.com/v1/databases/%DB_ID%/query'\
-H 'Authorization: Bearer %SECRET%'   \
-H 'Notion-Version: 2021-05-13'   \
--data '{
        "start_cursor" : "%NEXT_CURSOR_FROM_PREV_REQUEST%"    
}' > notion_db2.json