Closed nynevi closed 4 weeks ago
Discovered while working on https://github.com/transitive-bullshit/nextjs-notion-starter-kit/issues/618
The line here https://github.com/NotionX/react-notion-x/blob/master/packages/notion-client/src/notion-api.ts#L606 makes the below request:
curl --location 'https://www.notion.so/api/v3/search' \ --header 'Content-Type: application/json' \ --header 'Cookie: __cf_bm=l9fYQeZBInjE_IYkZfI39Rl84cClfIeJ9kCFQsKLGpc-1719470820-1.0.1.1-qFgBx5G_xqV_lkEMjjrVP5CSifPI.ZZ5vTvMbItNYy0tlItIWVr46e_2qYJYcXpmkS7OvvPlmWZCcr_ttBADkw; _cfuvid=T0dzvs1rxC8sFknZk47Efnx912M1XYiciVUPvyZ8S8A-1719470820038-0.0.1.1-604800000; device_id=6513a169-b1fc-404a-9ce8-3d4f6e450778; notion_browser_id=5d90bc05-2cad-4554-b6c5-f9bb2da47c67; notion_check_cookie_consent=false' \ --data '{ "type": "BlocksInAncestor", "source": "quick_find_public", "ancestorId": "0191bcee-9db0-4c36-90b8-4062af8f12e2", "sort": "Relevance", "limit": 20, "query": "", "filters": { "isDeletedOnly": false, "isNavigableOnly": false, "excludeTemplates": true, "requireEditPermissions": false, "ancestors": [], "createdBy": [], "editedBy": [], "lastEditedTime": {}, "createdTime": {} } }'
and gets:
{ "errorId": "519936dd-0928-445f-8a4f-f223acef4a89", "name": "ValidationError", "debugMessage": "Invalid input.", "message": "Something went wrong. (400)" }
Notion endpoint https://www.notion.so/api/v3/search does not seem to be publicly documented. I reversed engineer on Notion site by checking what might be considered as an invalid input. The culprit seems to be: "sort": "Relevance" versus
https://www.notion.so/api/v3/search
"sort": "Relevance"
"sort": { "field": "relevance" },
my bad, the starter kit seems to use an old version of this package. here the query is actually fixed https://github.com/NotionX/react-notion-x/blob/master/packages/notion-client/src/notion-api.ts#L552
Discovered while working on https://github.com/transitive-bullshit/nextjs-notion-starter-kit/issues/618
The line here https://github.com/NotionX/react-notion-x/blob/master/packages/notion-client/src/notion-api.ts#L606 makes the below request:
and gets:
Notion endpoint
https://www.notion.so/api/v3/search
does not seem to be publicly documented. I reversed engineer on Notion site by checking what might be considered as an invalid input. The culprit seems to be:"sort": "Relevance"
versus