User Tools

Site Tools


en:public:developer:template_system:tags:api:json_response_format

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:public:developer:template_system:tags:api:json_response_format [2013/03/08 12:01]
admin [Object Representation]
en:public:developer:template_system:tags:api:json_response_format [2013/03/08 12:48] (current)
admin [Callback Function]
Line 70: Line 70:
  
 When a request is successful, the following JSON is returned: When a request is successful, the following JSON is returned:
-{...}+{stat":"ok",...}
  
 The single object passed in the function call represents the REST outer <rsp> element.  The single object passed in the function call represents the REST outer <rsp> element. 
Line 139: Line 139:
 ===== Failure Responses ===== ===== Failure Responses =====
  
-Failure responses also call the jsonFlickrApi() method, but with a different JSON object. The object is not structured like the REST failure responses - instead it's simplified for JSON. For example: +Failure responses will return a different JSON object.  
-jsonFlickrApi({ +The object is not structured like the REST failure responses -  
- "stat" : "fail", +instead it's simplified for JSON. For example:
- "code" : "97", +
- "message" : "Missing signature" +
-})+
  
- From JavaScript, you can check rsp.stat for failure, and then read the error from rsp.code and rsp.message.+<code javascript> 
 +  
 +    "stat": "fail", 
 +    "code": "97", 
 +    "message": "Error message" 
 +  } 
 +</code> 
 + 
 +From JavaScript, you can check rsp.stat for failure, and then read the  
 +error from rsp.code and rsp.message.
  
 ===== Callback Function ===== ===== Callback Function =====
  
-If you just want the raw JSON, with no function wrapper, add the parameter nojsoncallback with value of 1 to your request.+To define your own callback function name, add the parameter **jsoncallback** with your desired name as  
 +the value.
  
-To define your own callback function name, add the parameter jsoncallback with your desired name as the value. +no jsoncallback -> {"stat":"ok",...}\\ 
-nojsoncallback=1 -> {...} +jsoncallback=wooYay -> wooYay({"stat":"ok",...});
-jsoncallback=wooYay -> wooYay({...});+
  
en/public/developer/template_system/tags/api/json_response_format.1362729676.txt.gz · Last modified: 2013/03/08 12:01 by admin