The Palace Project Palace Manager provides a general “API” endpoint for requesting items in a library collection as part of it implementation of the Open Publication Distribution System, (OPDS) protocol.

The endpoint response is an XML document conforming to the the OPDS protocol spec. As such it describes various content available in the library, links tot eh content or links to groupd of content.

In order to provide a search endpoint that supports both basic (keyword based) and advanced search, an OPDS Catalog published by the Palace Manager provides the following template in its [OpenSearch] Description document:

<OpenSearchDescription xmlns="[<http://a9.com/-/spec/opensearch/1.1/>](<http://a9.com/-/spec/opensearch/1.1/>)">
<ShortName>Search</ShortName>
<Description>Search Main Street City Library</Description>
<Tags>main-street-city-library</Tags>
<Url type="application/atom+xml;profile=opds-catalog" template="[<https://demo.thepalaceproject.org/GA0000/search/?entrypoint=All&amp;order=relevance&amp;available=all&amp;collection=full&amp;q={searchTerms}>](<https://demo.thepalaceproject.org/GA0000/search/?entrypoint=All&amp;order=relevance&amp;available=all&amp;collection=full&amp;q=%7BsearchTerms%7D>)"/>
</OpenSearchDescription>

Within the Description Document is the search endpoint url

[<https://demo.thepalaceproject.org/GA0000/search/?entrypoint=All&amp;order=relevance&amp;available=all&amp;collection=full&amp;q={searchTerms}>](<https://demo.thepalaceproject.org/GA0000/search/?entrypoint=All&amp;order=relevance&amp;available=all&amp;collection=full&amp;q=%7BsearchTerms%7D>)

OPDS specifies Open Search so the url endpoint is formatted for a particular library collection

For Main Street Library (A Fictional Library for demo Purposes)

is [<https://demo.thepalaceproject.org/ga0000>](<https://demo.thepalaceproject.org/>)

Where as the “GA0000” is the account ID (normal a Public library’s FSCS ID or IPED ID)

Simply appending the Collection Manager url with /search/?q= and including a search term will result in an endpoint response formatted via the OPDS 1.2 Protocol (XML) with the search results.

Advanced Search endpoint

The advanced search endpoint needed a very precise search language to query for books while creating custom lists. A JSON language was selected for this purpose.

Query format

The format for the query uses the JSON language format for ease of machine readability and programming use.

The root element

The root element will ALWAYS be a query object.