-
Notifications
You must be signed in to change notification settings - Fork 0
api example query
Jay Williams edited this page Mar 7, 2012
·
6 revisions
This is requesting the photo 123456
informations: title
, description
and publish-date
Here we ask for json format in response but we can ask for xml format too. Same method is used with http POST method.
GET http://www.something.com/api/photo.get/json/?id=123456&fields[]=title&fields[]=description&fields[]=publish-date
The requested data are provided like this:
{
"status" : "valid",
"response" :
{
"title" : "My best photo",
"description" : "This photo was token ..."
"publish-date" : "2011-08-24T12:33:42+01:00"
}
}
If an error occurs like an unknown photo id:
{
"status" : "error",
"code" : "no_result",
"message" : "There is no photo corresponding to the 'id' : 123456"
}
If you need to provide data which are not in the request body (beside method), you have extra url parameters to accomplish that. This is used for authentication.
Here a JSON
request:
{
"method" : "comment.get",
"extra_data_1" : "foo",
"extra_data_2" : "bar",
"request" :
{
"id" : 123456
}
}
And its Query
equivalent:
GET http://example.com/api/comment.get/xml/extra_data_1:foo/extra_data_2:bar/?id=123456