-
Notifications
You must be signed in to change notification settings - Fork 256
Atom Responses
Blacklight will provide atom responses for all catalog/index results. Just add ".atom" on to the end of your path component, "/catalog.atom", or "/catalog/index.atom".
The Atom response is intended to be pretty full of data, so it can fill many 'api' needs. It makes use of every relevant atom or opensearch element that could be conveniently included.
Additionally, the same HTML summary included in your HTML results pages are included as an atom:summary element -- the atom template uses the #render_document_partial helper method to generate this HTML summary, so if you've over-ridden that for your app, it'll get picked up in atom too.
An even more useful feature for API-like use of Atom, is the support for arbitrary format representations in the atom:content element. You can include &content_format=some_format in your Atom request URL. Any format a given document can be exported as using the Blacklight document framework is available. Not every document can export in every format -- if a format is requested one or more of the items in your atom result can not export as, they simply wont' have an atom:content element. XML as well as non-XML formats are supported (non-XML is Base64-encoded as per Atom spec, unless it's text/plain).
This means that if you add on a document extension that provides more export formats for some or all of your documents, that will automatically be available in the atom response.
If you choose to use the Blacklight CQL add-on , the combination of CQL requests and Atom responses provides a pretty good more-or-less standards-based API to search results through Blacklight.
The Atom response generating template is at app/views/catalog/index.builder.atom