How to consume this API

When doing requests, it's good to know that:

Reset our dataset

GET /build-db

Resource Collection

GET    /clients
GET    /clients/1
POST   /clients
PUT    /clients/1
PATCH  /clients/1
DELETE /clients/1
GET    /sites
GET    /sites/1
POST   /sites
PUT    /sites/1
PATCH  /sites/1
DELETE /sites/1

Singular routes

GET    /me
PUT    /me
PATCH  /me
GET    /version

Filter

Use . to access deep properties

GET /clients?givenName=adonis&author=typicode
GET /clients?id=1&id=2
GET /sites?client.givenName=adonis

Paginate

Use _page and optionally _limit to paginate returned data.

In the Link header you'll get first, prev, next and last links.

GET /clients?_page=7
GET /clients?_page=7&_limit=20

10 items are returned by default

Sort

Add _sort and _order (ascending order by default)

GET /clients?_sort=createdAt&_order=asc
GET /clients/1/sites?_sort=createdAt&_order=asc

For multiple fields, use the following format:

GET /clients?_sort=createdAt,updatedAt&_order=desc,asc

Slice

Add _start and _end or _limit (an X-Total-Count header is included in the response)

GET /clients?_start=20&_end=30
GET /clients/1/sites?_start=20&_end=30
GET /clients/1/sites?_start=20&_limit=10

Works exactly as Array.slice (i.e. _start is inclusive and _end exclusive)

Operators

Add _gte or _lte for getting a range

GET /clients?views_gte=10&views_lte=20

Add _ne to exclude a value

GET /clients?id_ne=1

Add _like to filter (RegExp supported)

GET /clients?givenName_like=adonis

Full-text search

Add q

GET /clients?q=ado

Relationships

To include children resources, add _embed

GET /clients?_embed=sites
GET /clients/1?_embed=sites

To include parent resource, add _expand

GET /sites?_expand=client
GET /sites/1?_expand=client