Pagination

Requests for collections and lists (e.g., multiple work orders and clients) typically return a paginated response. Other requests to create, update, or delete a Field Nation component will return the object’s parameters. These parameters can also include a paginated list (e.g., a client with multiple projects).

Query Parameters

You can use the following parameters to make a paginated request.

Parameter Type Example Notes
per_page integer &per_page=50 Number of objects (e.g., clients, projects) per page. Optional.
Returns up to 25 by default. per_page should not exceed 100.
page integer &page=2 Current page number. Required only if your total count exceeds the number per_page.
Use this parameter to request the next set of objects.

Paginated Response

When you make a request for a paginated response, paging information is located in the Response > metadata object. total is the total number of objects. If pages is greater than 1, you’ll need to request the next page: https://URL?access_token=abc123defg459hijk786lmn45&page=2.


"metadata":{
   "total":33,
   "page":1,
   "pages":2,
   "per_page":25,
   "columns":"id",
   "view":"model",
   "sort":"",
   "order":"asc",
   "list":""
}

Object parameters (e.g., work order ids or client ids) are located in the Response > results object. results will vary depending on the options available for each endpoint.


"results":[
   {
      "id":188
   },
   {
      "id":187
   }
]
 

Example

The following example includes a paginated response for client ids. Refer to Get Clients and Projects for more information.

https://URL/clients?access_token=abc123defg459hijk786lmn45


{
    "actions": [
        "add"
    ],
    "metadata": {
        "total": 4,
        "page": 1,
        "pages": 1,
        "per_page": 25,
        "columns": "",
        "view": "model",
        "sort": "",
        "order": "asc",
        "list": "clients_all"
    },
    "params": [],
    "lists": [
        {
            "id": "clients_all",
            "label": "Clients",
            "empty_message": "There are no results to display.",
            "selected": true,
            "actions": [
                "add"
            ],
            "count": -1
        }
    ],
    "results": [
        {
            "id": 188
        },
        {
            "id": 190
        },
        {
            "id": 189
        },
        {
            "id": 187
        }
    ],
    "search_text": "Search by title, keywords, etc.",
    "correlation_id": "clients"
}