Skip to content

Instantly share code, notes, and snippets.

@ReeganExE
Last active September 26, 2016 08:19
Show Gist options
  • Save ReeganExE/635c1fc9046c04ec635d69b6b5418b27 to your computer and use it in GitHub Desktop.
Save ReeganExE/635c1fc9046c04ec635d69b6b5418b27 to your computer and use it in GitHub Desktop.
Patients REST

Plural routes

GET    /patients
GET    /patients/1
POST   /patients
PUT    /patients/1
PATCH  /patients/1
DELETE /patients/1

Filter

GET /patients?name=Cuong
GET /patients?id=1&id=2
GET /comments?author.name=typicode

Slice

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

GET /patients?_start=20&_end=30&_limit=10

Sort

Add _sort and _order (ascending order by default)

GET /patients?_sort=name&_order=DESC

Operators

Add _gte or _lte for getting a range

GET /patients?age_gte=10&age_lte=20

Add _ne to exclude a value

GET /patients?id_ne=1

Add _like to filter using RegExp

GET /patients?name_like=Cuong

Full-text search

Add q

GET /patients?q=Cuong

Database

GET /db
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment