3

I'm trying to search into my workspace to find a page with the mention "Nora" inside the title. Here is the Python code I'm working with:

data = {
    'query': 'Nora',
    'page_size': 10
}

r = requests.post('https://api.notion.com/v1/search', headers={
    'Authorization': f"Bearer {token}",
    'Content-Type': 'application/json',
    'Notion-Version': "2022-02-22"
}, data=json.dumps(data))

result = r.json()
print(result)

The content of result is as follow:

{
    'object': 'list', 
    'results': [], 
    'next_cursor': None, 
    'has_more': False, 
    'type': 'page_or_database', 
    'page_or_database': {}
}

Same thing when I try with cURL:

curl -X POST 'https://api.notion.com/v1/search' -H 'Authorization: Bearer blablabla' \
        -H 'Content-Type: application/json' \
        -H 'Notion-Version: 2022-02-22' \
        --data '{"query": "Nora", "page_size": 10}'

Of course the Bearer is not blablabla, and I double checked if I was in the right workspace (which I am). My query doesn't have the \ (all in one line, only added the slashes for reading).

Is there something else I should do?

Havarem
  • 85
  • 1
  • 6

3 Answers3

1

I found the solution. It appears that now you need to "share" the pages you want to access to your integration beforehand. I don't know if it solves your problem Genaro Alberto Cancino Herrera, maybe they change their API recently and added that feature.

Havarem
  • 85
  • 1
  • 6
0

You have to click share and then "Invite" your integration account

0

it's under "connections" now. You can find your integration by name

nicccchh
  • 23
  • 4