...
One of the main reasons for this API is to help implementing Javascript / AJAX interaction. You can see here an example of an AJAX call that retrieves ContentInfo (e.g. metadata) for a content item.
Code Block | ||||
---|---|---|---|---|
| ||||
<pre id="rest-output"></pre> <script> var resource = '/api/ezp/v2/content/objects/59', log = document.getElementById( 'rest-output' ); log.innerHTML = "Loading the content info from " + resource + "..."; var request = new XMLHttpRequest(); request.open('GET', resource, true); request.onreadystatechange = function () { if ( request.readyState === 4 ) { log.innerHTML = "HTTP response from " + resource + "\n\n" + request.getAllResponseHeaders() + "\n" + request.responseText; } }; request.setRequestHeader('Accept', 'application/vnd.ez.api.ContentInfo+json'); request.send(); </script> |
...