Jsonp: Difference between revisions
Jump to navigation
Jump to search
w>Mpolo Added jsonp |
m 2 revisions imported |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
Our api can also be called from browser pages directly using [http://en.wikipedia.org/wiki/JSON#Padding JSON Padding]. | Our api can also be called from browser pages directly using [http://en.wikipedia.org/wiki/JSON#Padding 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 | * '''format:''' jsonp | ||
* '''jscb:''' Optional callback function name or defaults to scApiCall | * '''jscb:''' Optional callback function name or defaults to scApiCall | ||
= Example = | = Example = | ||
Line 18: | Line 17: | ||
RESPONSE: | RESPONSE: | ||
< | <pre> | ||
scApiCall({"ztime": "1299160340948"}) | scApiCall({"ztime": "1299160340948"}) | ||
</nowiki> | </pre> | ||
REQUEST: | |||
<nowiki>https://api.safecreative.org/v2/?component=ztime&format=jsonp&jscb=myFunction</nowiki> | |||
RESPONSE: | |||
<pre> | |||
myFunction({"ztime": "1299160340948"}) | |||
</pre> |
Latest revision as of 08:07, 7 May 2021
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
RESPONSE:
scApiCall({"ztime": "1299160340948"})
REQUEST:
https://api.safecreative.org/v2/?component=ztime&format=jsonp&jscb=myFunction
RESPONSE:
myFunction({"ztime": "1299160340948"})