API route responses
Responses from API routes follow a specific pattern.
The results are contained in a JSON style "string" with following sections
- links
- data
- meta
Links/meta excerpt from a response with four pages
{
"links": {
"self":"http://127.0.0.1/api_6x/api/index.php/v1/config/application
?page%5Boffset%5D=30&page%5Blimit%5D=30",
"first": "http://127.0.0.1/api_6x/api/index.php/v1/config/application
?page%5Boffset%5D=0&page%5Blimit%5D=30",
"previous": "http://127.0.0.1/api_6x/api/index.php/v1/config/application
?page%5Boffset%5D=0&page%5Blimit%5D=30",
"next": "http://127.0.0.1/api_6x/api/index.php/v1/config/application
?page%5Boffset%5D=60&page%5Blimit%5D=30",
"last": "http://127.0.0.1/api_6x/api/index.php/v1/config/application
?page%5Boffset%5D=90&page%5Blimit%5D=30"
},
"data": [ ... ],
"meta": {
"total-pages": 4
}
}
Links / meta sections of API response
Pagination
- links:
- self: The link used in the API call
- first: First set in pagination lists
- previous: Previous set in pagination lists
- next: Next set in pagination lists
- last: Last set in pagination lists
- meta:
- total-pages: Count of sets
The links and the "meta: total-pages" sections support easy pagination handling by direct use of the links. Each link contains the page offset in items and the number of items to return.
The data section contains the data of the response.