Skip to content

Instantly share code, notes, and snippets.

@ezimuel
Created Jul 24, 2013
Embed
What would you like to do?
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