Jsonp

From Safe Creative API
Revision as of 08:07, 7 May 2021 by Adminwiki (talk | contribs) (2 revisions imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Our api can also be called from browser pages directly using JSON Padding. Simply add a format parameter with value jsonp to any call and you will get the json response wrapped in a function called scApiCall.

Parameters

  • format: jsonp
  • jscb: Optional callback function name or defaults to scApiCall

Example

REQUEST:

https://api.safecreative.org/v2/?component=ztime&format=jsonp

Test it on your browser

RESPONSE:

scApiCall({"ztime": "1299160340948"})

REQUEST:

https://api.safecreative.org/v2/?component=ztime&format=jsonp&jscb=myFunction

RESPONSE:

myFunction({"ztime": "1299160340948"})