JSONP¶
JavaScript callbacks (JSONP) can be enabled by adding the parameter callback with the desired JS-method name as value. JSONP only works for GET calls whose response has a JSON content type (application/json, application/ld+json or application/rdf+json). The wrapped response has the content type application/javascript.
Browsers send a wildcard Accept header when loading a script, which results in RDF/XML for entries. Add the parameter format=application/json to get JSON, see HTTP caching and formats.
Example¶
GET http://base/1/entry/1?format=application/json&callback=test
This will wrap the whole response into a JavaScript method with the given name.
The callback name must be a JavaScript identifier or a dotted member expression (e.g. angular.callbacks._0) of at most 128 characters; other names are answered with 400. If the parameter is empty, callback is used as name. JSONP responses carry X-Content-Type-Options: nosniff and are not cached (Cache-Control: no-store). JSONP has no effect on the SPARQL endpoint and on String resources.
JSONP is a legacy technique; CORS is the preferred mechanism. JSONP can be disabled in entrystore.properties:
entrystore.jsonp=true|false (default: true)
EntryStore 5.x
5.x accepts any callback name, does not set nosniff or Cache-Control on JSONP responses, and also wraps SPARQL results and String resources.