Skip to contents

Handle all users operations in the Notion API

Note: Access this endpoint through the client instance, e.g., notion$users. Not to be instantiated directly.

Value

A list containing the parsed API response.

Methods


Method new()

Initialise users endpoint. Not to be called directly, e.g., use notion$users instead.

Usage

UsersEndpoint$new(client)

Arguments

client

Notion Client instance


Method list()

List all users

Usage

UsersEndpoint$list(start_cursor = NULL, page_size = NULL)

Arguments

start_cursor

Character. For pagination. If provided, returns results starting from this cursor. If NULL, returns the first page of results.

page_size

Integer. Number of items to return per page (1-100). Defaults to 100.


Method retrieve()

Retrieve a user

Usage

UsersEndpoint$retrieve(user_id)

Arguments

user_id

Character (required). The ID of the user to retrieve.


Method me()

Retrieve the bot User associated with the API token

Usage

UsersEndpoint$me()

Examples

notion <- notion_client()

# ----- list all users
notion$users$list()
#> {
#>   "object": "list",
#>   "results": [
#>     {
#>       "object": "user",
#>       "id": "fda12729-108d-4eb5-bbfb-a8f0886794d1",
#>       "name": "Brenwin",
#>       "avatar_url": {},
#>       "type": "person",
#>       "person": {}
#>     },
#>     {
#>       "object": "user",
#>       "id": "6b786605-e456-4237-9c61-5efaff23c081",
#>       "name": "brenwin-internal",
#>       "avatar_url": {},
#>       "type": "bot",
#>       "bot": {
#>         "owner": {
#>           "type": "workspace",
#>           "workspace": true
#>         },
#>         "workspace_name": "Brenwin's Notion",
#>         "workspace_limits": {
#>           "max_file_upload_size_in_bytes": 5368709120
#>         }
#>       }
#>     }
#>   ],
#>   "next_cursor": {},
#>   "has_more": false,
#>   "type": "user",
#>   "user": {},
#>   "request_id": "fd112634-e4c9-4953-a557-43326deb3f41"
#> } 

# ----- retrieve a user
notion$users$retrieve(user_id = "fda12729-108d-4eb5-bbfb-a8f0886794d1")
#> {
#>   "object": "user",
#>   "id": "fda12729-108d-4eb5-bbfb-a8f0886794d1",
#>   "name": "Brenwin",
#>   "avatar_url": {},
#>   "type": "person",
#>   "person": {},
#>   "request_id": "f53db350-84cc-4efd-a8cc-cb9a01d0059b"
#> } 

# ----- retrieve the bot User associated with the API token
notion$users$me()
#> {
#>   "object": "user",
#>   "id": "6b786605-e456-4237-9c61-5efaff23c081",
#>   "name": "brenwin-internal",
#>   "avatar_url": {},
#>   "type": "bot",
#>   "bot": {
#>     "owner": {
#>       "type": "workspace",
#>       "workspace": true
#>     },
#>     "workspace_name": "Brenwin's Notion",
#>     "workspace_limits": {
#>       "max_file_upload_size_in_bytes": 5368709120
#>     }
#>   },
#>   "request_id": "065294fa-c8a4-465a-af1f-07360dd262cf"
#> }