• AnsibleFest
  • Products
  • Community
  • Webinars & Training
  • Blog
Ansible Logo
AWX community documentation
Ansible AWX
latest
latest

Get started

  • AWX Quickstart

Community

  • AWX Contributor’s Guide

Users

  • Automating with AWX

Developers

  • AWX API Reference
    • AWX API Reference
    • 1. Tools
    • 2. Browsable API
    • 3. Conventions
    • 4. Sorting
    • 5. Searching
    • 6. Filtering
    • 7. Pagination
    • 8. Access Resources
    • 9. Read-only Fields
    • 10. Authentication Methods Using the API

Administrators

  • Administering AWX Deployments
  • Upgrades and Migrations

Release notes

  • Release Notes
Ansible AWX
  • AWX API Reference
  • 7. Pagination
  • View page source

7. Pagination

Responses for collections in the API are paginated. This means that while a collection may contain tens or hundreds of thousands of objects, in each web request, only a limited number of results are returned for API performance reasons.

When you get back the result for a collection you will see something similar to the following:

{'count': 25, 'next': 'http://testserver/api/v2/some_resource?page=2', 'previous': None, 'results': [ ... ] }

To get the next page, simply request the page given by the ‘next’ sequential URL.

Use the page_size=XX query string parameter to change the number of results returned for each request.

The page_size has a default maximum limit configured to 200, which is enforced when a user tries a value beyond it, for example, ?page_size=1000. However, you can change this limit by setting the value in /etc/awx/conf.d/<some file>.py to something higher, e.g. MAX_PAGE_SIZE=1000.

Use the page query string parameter to retrieve a particular page of results.

http://<server name>/api/v2/model_verbose_name?page_size=100&page=2

The previous and next links returned with the results will set these query string parameters automatically.

The serializer is quite efficient, but you should probably not request page sizes beyond a couple of hundred.

The user interface uses smaller values to avoid the user having to do a lot of scrolling.

Previous Next

© Copyright 2023, Red Hat.

Built with Sphinx using a Sphinx Ansible Theme that is based on the Read the Docs theme and is maintained by the Ansible Community.