# Pagination

List endpoints return one page of results. Version 1 grew from several modules, so two page formats exist. Each
endpoint keeps its format for the life of v1.

## Service jobs

`GET /v1/tickets` takes `page` and `per_page` (1 to 100, default 15) and answers:

```json
{
  "data": [ { "id": "9a7c3e1f-2b4d-4e6f-8a1c-3d5e7f9b1c2d", "ticket_number": "TKT-0123" } ],
  "pagination": {
    "total": 42,
    "per_page": 15,
    "current_page": 1,
    "last_page": 3,
    "from": 1,
    "to": 15
  }
}
```

Request the next page until `current_page` equals `last_page`.

## Clients

`GET /v1/clients` takes `pageIndex` (from 1) and `pageSize` (1 to 100, default 10) and answers:

```json
{
  "data": [ { "id": "b8f2a1c4-7d39-4e52-9a06-1f4c8b3d5e27", "name": "Demo Client" } ],
  "links": {
    "first": "https://api.invoicing.proradius.co/v1/clients?pageIndex=1",
    "last": "https://api.invoicing.proradius.co/v1/clients?pageIndex=6",
    "prev": null,
    "next": "https://api.invoicing.proradius.co/v1/clients?pageIndex=2"
  },
  "meta": {
    "current_page": 1,
    "from": 1,
    "last_page": 6,
    "path": "https://api.invoicing.proradius.co/v1/clients",
    "per_page": 10,
    "to": 10,
    "total": 58
  }
}
```

Follow `links.next` until it is `null`.

## Webhook deliveries

`GET /v1/webhooks/{uuid}/deliveries` takes `page` and `per_page` (1 to 100, default 20) and answers with `data`,
`links` and `meta`, like the clients list.

## Lists without pages

These endpoints return everything at once:

| Endpoint | Body |
| --- | --- |
| `GET /v1/webhooks` | A plain array. An organization has at most 10 endpoints. |
| `GET /v1/ticket-technicians` | A plain array. |
| `GET /v1/ticket-boards` | `{ "data": [...] }` |
| `GET /v1/ticket-job-types` | `{ "data": [...] }` |