Pagination and filtering #
Every list endpoint (GET /account, GET /transaction, GET /category and so on) returns a page of results:
{
"status": "success",
"data": [ { "id": 7, "name": "Clients", "account_type": "RECEIVABLE", "type": "Receivable" } ],
"meta": { "current_page": 1, "per_page": 5, "total": 23, "last_page": 5 }
}
| Parameter | Default | Range |
|---|---|---|
perPage | 5 | 1 to 200 |
page | 1 | 1 to meta.last_page |
Results are always ordered by id, so paging through them is stable.
Filters #
Filters narrow a list on the server. They combine, and they apply on every page.
| Endpoint | Parameter | Matches |
|---|---|---|
GET /account | account-type | Exactly. One of the codes listed in /meta under vocabularies.account_types, e.g. RECEIVABLE |
name | Case-insensitive substring | |
category-id | Exactly | |
currency-id | Exactly | |
GET /transaction | transaction-type | Exactly, e.g. IN |
account-id | Exactly | |
start-date, end-date | transaction_date within the range, inclusive | |
GET /category | category-type | Exactly |
curl "https://api.microbooks.io/books/v1/account?account-type=RECEIVABLE&perPage=50" \
-H "Authorization: Bearer $TOKEN"
An invalid filter value, such as an unknown account type, is a 422, not an empty page. A parameter the endpoint does not accept is also a 422; see Conventions.