Platform API‎ > ‎Output Types‎ > ‎

JSONP Content Negotiation

It is the combination of the output parameter (or Accept header) and the callback parameter that specifies JSONP output. If the output parameter is any other value than json, (or the Accept header is not application/javascript or */*) then the callback parameter will be ignored.

Output Param ValueAccept Header CallbackOutput Format
 jsonapplication/javascript {valid javascript identifier}JSONP with mime-type application/javascript
{NOT json, e.g., xml}application/javascript {valid javascript identifier} XML format depending on the query type - see Output Formats section above. (Because output overrides the Accept header and callback)
{NOT json, e.g., xml} {valid javascript identifier} XML format (the output parameter is not json so the callback value is ignored}
json */* {valid javascript identifier}JSONP with mime-type application/javascript

 */*{valid javascript identifier}JSONP with mime-type application/javascript 
  {valid javascript identifier}JSONP with mime-type application/javascript ("If no Accept header field is present, then it is assumed that the client accept all media types")
  {Invalid callback - not a valid javascript identifier}Error Response (HTTP Bad Request) ("If no Accept header field is present, then it is assumed that the client accept all media types")
json {valid javascript identifier} JSONP with mime-type application/javascript

 application/javascript{valid javascript identifier} JSONP with mime-type application/javascript
 json  JSON format (see table in Output Formats section above). This is the case if callback is either empty or doesn't exist.
 Is set e.g., application/xml (NOT application/javascript OR */* OR no header){valid javascript identifier}XML format depending on the query type - see Output Formats section above. (Because no output parameter is set and the Accept header does not include javascript.)
   XML format (No output or accept header or callback (or callback parameter exists but value is empty))
 json     {Invalid callback - not a valid javascript identifier}Error Response (HTTP Bad Request)
{output set but not supported} {valid javascript identifier} Error Response (HTTP Bad Request} 
  application/javascript Error Response (HTTP Bad Request} Because there is no callback parameter value set. 
  application/javascript{Invalid callback - not a valid javascript identifier}Error Response (HTTP Bad Request)

 */*{Invalid callback - not a valid javascript identifier}Error Response (HTTP Bad Request)
  */*{callback parameter exists in querystring but is empty}XML format - as there is no output parameter and this is the default format to return.
  application/javascript, */* XML format - as */* exists in the headers then will return the default XML format

Comments