Pagination

Requests that return more than a single result will often times be “paged” such that we return a limited number of records for each request. All top-level API resources have bulk fetches via "GET" API methods in order to list Locations, Insights, and Alerts along with their Linked Locations.

As of today, the structure of the request relies on cursor-based pagination such that the list starts at a pre-defined page offset and continues until a pre-defined limit - as resolved for self under links.

The response format is similar such that the collection of the resources is listed under the resource name in the body's data attribute, while the links to traverse to next or prev pages are detailed under links.

Below is an example of a paginated response:

{
    "data": {
        "locations": [
            {
                "id": "5ece4524726e55000703833f",
                "name": "North Carolina",
                "geometry": {
                    "type": "Point",
                    "coordinates": [
                        -79.48081469070964,
                        34.57785716540468
                    ]
                },
                "createdAt": "2020-05-27T10:47:00.229Z",
                "updatedAt": "2020-05-27T10:47:00.229Z"
            }
        ]
    },
    "links": {
        "self": "http://api.tomorrow.io/v4/locations?offset=3&limit=1",
        "prev": "http://api.tomorrow.io/v4/locations?offset=2&limit=1",
        "next": "http://api.tomorrow.io/v4/locations?offset=4&limit=1",
    }
}