Skip to content

Instantly share code, notes, and snippets.

@ezimuel
Created July 24, 2013 16:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ezimuel/6071979 to your computer and use it in GitHub Desktop.
Save ezimuel/6071979 to your computer and use it in GitHub Desktop.
API example calls
RPC: GET /getalbum
Request
{ "id" : 1 }
OK Response (200):
{
"id" : 1,
"artist" : {
"name" : "Metallica",
"history" : "Simply the best heavy metal band ever!",
"genre" : "Heavy metal, Hard rock, Speed metal, Thrash metal"
},
"title" : "Metallica",
"genre" : "Hard rock, Thrash metal",
"release_date" : "08-13-1991"
}
Error Response (400):
No body
---
REST : GET /album/1
Request:
No body
OK Response (200):
{
"album" : {
"id" : 1,
"artist" : {
"name" : "Metallica",
"history" : "Simply the best heavy metal band ever!",
"genre" : "Heavy metal, Hard rock, Speed metal, Thrash metal"
},
"title" : "Metallica",
"genre" : "Heavy metal",
"release_date" : "08-13-1991"
}
}
Error Response (400):
No body
REST : POST /album
Request:
{
"artist" : "Metallica",
"title" : "Load",
"genre" : "Heavy Metal",
"release_date" : "06-04-1996"
}
OK Response (200):
{
"album" : {
"id" : 2,
"artist" : {
"name" : "Metallica",
"history" : "Simply the best heavy metal band ever!",
"genre" : "Heavy metal, Hard rock, Speed metal, Thrash metal"
},
"title" : "Load",
"genre" : "Heavy metal",
"release_date" : "06-04-1996"
}
}
Error Response (400):
No body
REST: PUT /album/2
Request:
{
"album" : {
"genre" : "Heavy metal, Hard rock"
}
}
OK Response (200):
{
"album" : {
"id" : 2,
"artist" : {
"name" : "Metallica",
"history" : "Simply the best heavy metal band ever!",
"genre" : "Heavy metal, Hard rock, Speed metal, Thrash metal"
},
"title" : "Load",
"genre" : "Heavy metal, Hard rock",
"release_date" : "06-04-1996"
}
}
Error Response (400):
No body
REST: DELETE /album/2
Request:
No body
OK Response (200):
No body
Error Response (400):
No body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment