Notion API master series 23 - Analysis - List all users & Retrieve your token's bot user

소찬 (Chan)·2022년 12월 21일
0
post-thumbnail

Reference URL : List all users, Retrieve your token's bot user

We can inquire with API for the whole user.

user_list = notion.users.list()

Of course, this method supports page_size and start_cursor. Like below has_more is True, put start_cursor into next_cursor and see the following list result.

{'has_more': True,
 'next_cursor': 'a75f4717-6a45-4c2b-acec-38b6f3b752f0',
 'object': 'list',
 'results': [{'avatar_url': 'https://s3-us-west-2.amazonaws.com/public.notion-static.com/xxxx/profile.jpeg',
              'id': 'df4a9e4f-bb7d-4b69-a196-c79bf171a484', ...
  • start_cursor (string)
    If supplied, this endpoint will return a page of results starting after the cursor provided. If not supplied, this endpoint will return the first page of results.
    The maximum is 100 bunches via search. If the result exceeds 100 bunches, the response gives "has_more" : True and "next_cursor": "{unique id}". Refer to next_cursor and put start_cursor. You can obtain the 101st result and more.

  • page_size (int32)
    The number of items from the full list desired in the response. Maximum: 100
    You can set a bunch of sizes that you want at once. If you skip it, it will bring 100 bunches as the default value.

Retrieve your token's bot user and return the information of the bot user. You can call this method without any parameters.

bot_info = notion.users.me()
pprint(bot_info)

This result is the result for bot_info.

{'avatar_url': 'https://s3-us-west-2.amazonaws.com/public.notion-static.com/xxxx/summer.gif',
 'bot': {'owner': {'type': 'workspace', 'workspace': True}},
 'id': '4666301e-ddb5-45de-b2f9-88eec463052b',
 'name': 'ChanChan Test Bot',
 'object': 'user',
 'type': 'bot'}
profile
QA Specialist

0개의 댓글