iandees/xapi-servlet — Issue #23: JSONP support for JSON output
Author: samatjain
Created: 2012-03-02 00:21:04+00:00
State: open

[JSONP](http://en.wikipedia.org/wiki/JSONP) is a "standard" to allow cross-origin domain requests for use from JavaScript. It's an alternative to CORS (issue #22) for JavaScript interpreters.

Implementation is fairly simple: support a callback URL parameter ("callback" is an ad-hoc standard, which [jQuery supports](http://dochub.io/#jquery/jQuery.ajax)) in the GET/POST request.

E.g.

http://example.com/xapi/api/0.6/node/1.json?callback=an_arbitrary_name

Should return the otherwise normal JSON output "wrapped" in a function call, to a function named in the callback parameter. E.g. for the above:

E.g.

an_arbitrary_name()

A negative about JSONP: it, by itself, has no access control mechanism, so it may be a good idea to let users turn JSONP support off so random Websites on the Internet don't use their XAPI instances.