List operations in the Widgets API support bulk fetches. For instance, you can list organization members, list directory users, and list audit events. These operations share a common structure, taking at least these four arguments: limit, order, after, and before.
The Widgets API paginates via the after and before arguments. Both take a cursor from the listMetadata object of a previous response and return records in either ascending or descending order by creation time. Because cursors reference a specific record rather than a position, adding or removing records between requests will not cause a record to be skipped or repeated the way an offset would.
GraphQL
| query OrganizationMemberships($after: String) { | |
| organizationMemberships(limit: 25, order: Desc, after: $after) { | |
| data { | |
| id | |
| } | |
| listMetadata { | |
| after | |
| before | |
| } | |
| } | |
| } |
| { | |
| "data": { | |
| "organizationMemberships": { | |
| "data": [ | |
| { | |
| "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", | |
| "email": "marcelina@foo-corp.com" | |
| }, | |
| { | |
| "id": "user_01E2NPPCT7XQ2MVVYDHWGK1WN4", | |
| "email": "lucia@foo-corp.com" | |
| } | |
| ], | |
| "listMetadata": { | |
| "after": "user_01E2NPPCT7XQ2MVVYDHWGK1WN4", | |
| "before": null | |
| } | |
| } | |
| } | |
| } |