Red Hat Customer Portal Logo
AUTOMATION CONTROLLER
v4.2.0
You can find more information in the Ansible Automation Platform documentation.
  • Automation Controller API Guide v4.2.0
  • 1. Tools
  • 2. Browsable API
  • 3. Conventions
  • 4. Sorting
  • 5. Searching
  • 6. Filtering
  • 7. Pagination
  • 8. Access Resources
    • 8.1. Configuration Settings
    • 8.2. Identifier Format Protocol
  • 9. Read-only Fields
  • 10. Authentication Methods Using the API
    • 10.1. Session Authentication
    • 10.2. Basic Authentication
    • 10.3. OAuth 2 Token Authentication
    • 10.4. SSO Authentication
  • 11. Controller API Reference Guide
 
Automation Controller API Guide

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/tower/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.

Next Previous

Copyright © Red Hat, Inc.