Web API

The Web API

It is possible to use the Copac Search CGI script for machine to machine communications. For example a query url of http://copac.ac.uk/search?ti=marple%20railway performs a title keyword search for "marple railway." The result is an HTML page, but by modifying the url slightly you can get a machine friendly XML result.

To get XML results you need to add &format=XML+-+MODS to the url, eg http://copac.ac.uk/search?ti=marple%20railway&format=XML+-+MODS

The top level element of the result will be <modsCollection xmlns="http://www.loc.gov/mods/v3"> and it's child elements will be a series of <mods> records. The MODS schema is maintained by the Library Of Congress.

Setting the page size

The result is split into pages. The default page size is 25 records, but you can change the page size by setting by setting the Page-size header in the HTTP request, eg:
Page-size: 50
will split the result into pages of 50 records.

To get the second and subsequent pages of results you need to add the page variable to the url, eg: &page=2 will retrieve the second page of records, eg:
http://copac.ac.uk/search?ti=railway&page=2&format=XML+-+MODS
Page numbers start at 1. If no page variable is specified in the url then the whole result set is returned.

Number of records found by the query

The total number of records found by the query is returned in the Result-set-size HTTP header, eg:
Result-Set-Size:17

Types of query

All the types of query that are available through the Copac search forms are available using this method. All you need to do, is run the query from a search form, copy the result url and add the format and page variables as described above.

The most commonly used query variables are shown in the following table. All queries are performed as keyword searches, unless the search terms are enclosed in double quotes when a phrase search is performed.

VariableFields searched
anyAll fields
auAuthor
isnISSN or ISBN or other standard number
pubPublisher name
subSubject
tiTitle

Share This Page

  • Send to Facebook
  • Tweet this!
  • Email
  • Print