Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documenting continuationToken based pagination #12

Open
JulienPalard opened this issue Feb 21, 2023 · 0 comments
Open

Documenting continuationToken based pagination #12

JulienPalard opened this issue Feb 21, 2023 · 0 comments

Comments

@JulienPalard
Copy link

JulienPalard commented Feb 21, 2023

Bonjour !

I'm still experimenting with the client and the API, I think an example with a continuationToken would be helpfull. I'm using it as a cursor, and it looks to work as expected.

So a usage example may look like:

backup = []
endpoint = f"/v5/organizations/{args.org}/items"
params = {"pageSize": 100}
items = api.call(endpoint, params=params).json()
while items["data"]:
    backup.extend(items["data"])
    params["continuationToken"] = items["pagination"]["continuationToken"]
    items = api.call(endpoint, params=params).json()
Path(args.org).write_text(
    json.dumps(backup, indent=4, ensure_ascii=False), encoding="UTF-8"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant