Working with the JSON responses is quite straightforward. Except for a very few rare cases the JSON response has the same fields that its corresponding response in Atom format, but without any namespace on it. For example a JSON response for an item show request would be:
{
"countries":["USA"],
"original_title":"Lost",
"tvchannels":["abc","cuatro","fox_es"],
"title":"Lost",
"release_date_us":null,
"id":2021,
"item_type":"serie",
"posters":[{"href":"http://s3.amazonaws.com/partigidv/series/posters/50752/73739-7_thumb.jpg",
"size":"thumb","type":"image/jpeg","lang":""}],
"year":2004,
"url":"http://www.partigi.com/tv-shows/lost",
"credits":{"writers":null,
"director":{"person_name":"Damon Lindelof","person_id":71449},
"cast_members":[{"person_name":"Naveen Andrews","person_id":5933},{"person_name":"Matthew Fox","person_id":9743}],
"synopsis":"Forty-eight survivors of a near-fatal plane crash must learn to fend for themselves and fight the unusual occurrences on a deserted island.\\r\\n"
}
Note that some new line characters and spaces have been introduced in the example response for readability's sake.
The reponse example above corresponds to a show action, which returns just one object. For those methods that return a collection of objects the response would contain the keys previous_page
and next_page
along with the key corresponding to the plural of the elements of the collection. The later key has as value an array of elements similar to the example above. For instance, here is a response for a request to reviews index method:
{
"previous_page":null,
"next_page":2,
"reviews":[
{"id":173861,"user_id":5029,"status":2,"item_id":2021,"item_type":"serie","rating":5,"language":"es",
"text":"Tengo todas las 4 temporadas en DVD de la serie, es muy wena la verdad....jejeje\\n\\nSobre el Pack Exclusivo 5
\\u00c2\\u00aa Temporada (Kit de Orientaci\\u00c3\\u00b3n Dharma):\\nLa sexta temporada de esta increible serie, va a ser
que despues de la explosi\\u00c3\\u00b3n que hubo en la final de la anterior temporada, todos los supervivientes del vuelo 815 de
Oceanic apareceran de nuevo en la isla, pero esta vez regresaran todos los personajes, los que murier\\u00c3\\u00b3n de Dharma,
los de los "Otros" y los principales y secundarios, vamos todos entan vivos y los del vuelo 815 vuelven a casa y John Look
se queda a proteger la Isla. \\n\\npd: espero que os halla gustado ^^"},
{"rating":5,"language":null,"text":null,"id":173831,"user_id":1581,"status":1,"item_id":2021,"item_type":"serie"}
]
}
Go back to the main page
Comments (0)
You don't have permission to comment on this page.