Skip to content

Latest commit

 

History

History
17 lines (11 loc) · 855 Bytes

Pagination.md

File metadata and controls

17 lines (11 loc) · 855 Bytes

Some requests will return more than one page of results.

You'll need to use the value returned in the next: key as part of the URL to access the next page.

Set your API token and the next: value as variables, and then create the URL to access the next page. That may look like this:

shortcut_api_token = os.getenv('SHORTCUT_API_TOKEN')
next_page = results['next']

next_url = 'https://api.app.shortcut.com' + next_page + '&token='+ shortcut_api_token

Use the next_url that you've created to make another call to the API to get the next page of results.

The scripts change-label.py and send-stories-to-slack.py both contain examples of pagination.