# Pagination

`HTTPGET` endpoints have:

* `maxItems` optional parameter to act as a limit for how many results should be returned.
  * The default value is 250
* `nextPagingToken` in the response that can be used in subsequent requests to get the next results page.
  * As long as `nextPagingToken` differs from null, there are more results available.
  * When null, the last page of results has been reached.
  * To request a previous page, the client should keep track of previously requested paging tokens.

## Example

### Request

```bash
curl -D- -X GET <baseUrl>/api/v1/countries?maxItems=3 \
    -H 'Authorization: Bearer <ACCESS_TOKEN>'
    -H 'Content-Type: application/json' \
```

### Response

```json
{
    "countries": [
        {
            "cultureCode": "da-DK",
            "id": "0c53f836-9601-ec11-837b-64bc58542c92",
            "name": "Denmark"
        },
        {
            "cultureCode": "de-DE",
            "id": "1153f836-9601-ec11-837b-64bc58542c92",
            "name": "Germany"
        },
        {
            "cultureCode": "en-GB",
            "id": "0f53f836-9601-ec11-837b-64bc58542c92",
            "name": "Great Britain"
        }
    ],
    "nextPagingToken": "M3wzfGRjMDZlZGYxLTQ2MGQtNGVlZC1hMzMxLWJjNWYwMzI4NDlkNHxGYWxzZQ=="
}
```

## Next Page

```bash
curl -D- -X GET <baseUrl>/api/v1/countries?maxItems=3&nextPagingToken=M3wzfGRjMDZlZGYxLTQ2MGQtNGVlZC1hMzMxLWJjNWYwMzI4NDlkNHxGYWxzZQ== \
    -H 'Authorization: Bearer <ACCESS_TOKEN>'
    -H 'Content-Type: application/json' \
```

## Error Handling

| Error            | Description                                    |
| ---------------- | ---------------------------------------------- |
| BadRequest (400) | Paging token does not match the current query; |
