Skip to content

Instantly share code, notes, and snippets.

@jb41
Created October 1, 2015 14:09
Show Gist options
  • Save jb41/c34d544f3b0f099667ad to your computer and use it in GitHub Desktop.
Save jb41/c34d544f3b0f099667ad to your computer and use it in GitHub Desktop.
GET /
[
{ id: '1', name: 'Peter', score: '43' },
{ id: '2', name: 'Lois', score: '89' },
{ id: '3', name: 'Meg', score: '10' },
{ id: '4', name: 'Chris', score: '43' },
{ id: '5', name: 'Stewie', score: '72' }
]
GET /?fields="id,name"
[
{ id: '1', name: 'Peter' },
{ id: '2', name: 'Lois' },
{ id: '3', name: 'Meg' },
{ id: '4', name: 'Chris' },
{ id: '5', name: 'Stewie' }
]
##### ##### ##### ##### ##### ##### ##### ##### #####
GET /:col_name/:value
GET /name/Lois
[
{ id: '2', name: 'Lois', score: '9' }
]
GET /score/43
[
{ id: '1', name: 'Peter', score: '43' },
{ id: '4', name: 'Chris', score: '43' }
]
GET /score/43?fields="name"
[
{ name: 'Peter' },
{ name: 'Chris' }
]
##### ##### ##### ##### ##### ##### ##### ##### #####
GET /search?score=43&name=Peter
[
{ id: '1', name: 'Peter', score: '43' }
]
GET /search?score=43
[
{ id: '1', name: 'Peter', score: '43' },
{ id: '4', name: 'Chris', score: '43' }
]
##### ##### ##### ##### ##### ##### ##### ##### #####
POST / { id: '6', name: 'Glenn', score: '69' }
{ id: '6', name: 'Glenn', score: '69' }
POST / { rows: [{ id: '6', name: 'Glenn', score: '69' }, { id: '7', name: 'Joe', score: '98' } ] }
{
rows: [
{ id: '6', name: 'Glenn', score: '69' },
{ id: '7', name: 'Joe', score: '98' }
]
}
##### ##### ##### ##### ##### ##### ##### ##### #####
PUT /:name/:value
PUT /name/Lois { id: '2', name: 'LOIS', score: '100' }
{ id: '2', name: 'LOIS', score: '100' }
##### ##### ##### ##### ##### ##### ##### ##### #####
PATCH /:name/:value
PATCH /name/Lois { name: 'LOIS', score: '100' }
{ name: 'LOIS', score: '100' }
##### ##### ##### ##### ##### ##### ##### ##### #####
DELETE /:name/:value
DELETE /name/Lois
DELETE /score/43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment