When doing requests, it's good to know that:
If you make POST, PUT, PATCH or DELETE requests, changes will be automatically and saved without any validation rules.
Your request body JSON should be object enclosed, just like the GET output. (for example {"name": "Foobar"})
Id values are not mutable. Any id value in the body of your PUT or PATCH request will be ignored. Only a value set in a POST request will be respected, but only if not already taken.
A POST, PUT or PATCH request should include a Content-Type: application/json header to use the JSON in the request body. Otherwise it will result in a 200 OK but without changes being made to the data.
GET /build-db
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
GET /me
PUT /me
PATCH /me
GET /version
Use .
to access deep properties
GET /clients?givenName=adonis&author=typicode
GET /clients?id=1&id=2
GET /sites?client.givenName=adonis
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
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
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)
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
Add q
GET /clients?q=ado
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