Application Programming Interface (API)

Automatically Query correspSearch

Overview

With the help of the Application Programming Interface (API), you can query this web service automatically via URL parameters (see below). The results can be used and distributed under the terms of the Creative Commons License CC-BY 4.0

The correspSearch API (TEI-XML output format) is available in the stable version 1.0.

Output Formats

TEI-XML (stable)

Base URL: http://correspSearch.bbaw.de/api/v1/tei-xml.xql

The correspondence metadata are provided in TEI-XML format. The TEI encoding is generally compliant (apart from two differences) to the Correspondence Metadata Interchange (CMI) format, a highly reduced and restricted subset of the TEI Guidelines. See here for more information about the CMI format. The correspSearch API aggregates letter metadata from different sources which entails two necessary exceptions from the CMI format:

  1. Since it is possible that correspDesc elements represent different sources, each correspDesc element has to be linked to the source it refers to. This is done by usage of the attribute correspDesc/@cs:source, the value of which points to sourceDesc/bibl/@xml:id. Since the TEI Guidelines do not allow @source in correspDesc, this attribute has to be noted within a seperate namespace. The namespace for the abbreviation "cs" is http://www.bbaw.de/telota/correspSearch.
  2. The names of the data providers, who have to be mentioned due to the CC BY 4.0 license, are encoded in teiHeader//respStmt.

Example query: http://correspsearch.bbaw.de/api/v1/tei-xml.xql?correspondent=http://d-nb.info/gnd/118540238&startdate=1793-01-01&enddate=1808-02-02

TEI-JSON (beta)

Base URL: http://correspSearch.bbaw.de/api/v1/tei-json.xql

The results are provided as TEI data which come in a JSON format. For that purpose the TEI-XML data (see preceding section) are serialized with the help of the "exist-db JSON serializer". For more information about this serialization see the respective Blog post in the eXist-db blog. Due to the fact that the CMI format contains hardly any "mixed content" elements (i.e. XML elements with text and elements as children), the TEI-JSON output is highly correspondent to the TEI-XML output.

Example query: http://correspsearch.bbaw.de/api/v1/tei-json.xql?correspondent=http://d-nb.info/gnd/118540238&startdate=1793-01-01&enddate=1808-02-02

BEACON Format

Besides the TEI-API the web service correspSearch offers the possibility to create BEACON files (with the same parameters) for every Authority Controlled Files (e.g. VIAF). Thus it is possible to link to all letters from or to a specific person in correspSearch automatically. With every single link the end user will get to the corresponding search result in correspSearch.

Authority File Base URL
GND http://correspSearch.bbaw.de/api/v1/gnd-beacon.xql
VIAF http://correspSearch.bbaw.de/api/v1/viaf-beacon.xql
BNF http://correspSearch.bbaw.de/api/v1/bnf-beacon.xql
LC http://correspSearch.bbaw.de/api/v1/lc-beacon.xql

Example query of all correspondents who have a GND identifier: http://correspSearch.bbaw.de/api/v1/gnd-beacon.xql?correspondent=all

To query the BEACON interface you can use all URL parameters as described below. This, for instance, enables queries to output only Authority Controlled IDs of those persons, who have sent or received letters, postcards etc. in a specific period.

Please note that the BEACON interface will only return the Authority File IDs of the correspondents as definded by the BEACON format. To retrieve the full correspondence metadata please use the TEI-XML or TEI-JSON interface as described above.

CSV (experimental)

Base URL: http://correspSearch.bbaw.de/api/v1/csv.xql

The correspondence metadata are outputted in the CSV format. The CSV file uses semicolons (;) as dividers and quotes (") as text delimiters. At the end of the CSV file the data publishers are mentioned due to the CC-BY 4.0 license. The CSV interface is currently dedicated for the individual re-use of search results on your own computer. The interface uses (among others) a modified version of the XSLT "cmi2csv", developed by Klaus Rettinghaus (SAW Leipzig).

Please note that the table format isn't standardized yet and will subject to further developments. For machine-readable requests please use the TEI-XML or TEI-JSON interface as described above.

Licensing of the data

The data provided via the TEI-XML or the TEI-JSON API is available for subsequent use under the terms of the Creative Commons license CC-BY 4.0.

Parameters

Name Description Possible Values Example
correspondent Searches the database for the given correspondent regardless of his or her role (i.e. as sender or recipient). Unabridged persistent URL from one of the following sets of standardized data:
  • Gemeinsame Normdatei (GND) of the German National Library (Deutsche Nationalbibliothek, DNB)
  • Virtual Authority File (VIAF)
  • Autorités, Bibliothèque nationale de France (BNF)
  • Library of Congress (LC)
  • National Diet Library, Japan (NDL)

It is possible to select more than one person by using the parameter several times.

If the search is not restricted to a specific person, the value is set to all.

?correspondent=http://d-nb.info/gnd/118540238

?correspondent=all

sender Like correspondent but limited to the role as sender Like correspondent ?sender=http://d-nb.info/gnd/118540238
addressee Like correspondent but limited to the role as recipient Like correspondent ?addressee=http://d-nb.info/gnd/118540238
startdate Start date of the time period covered by the query Dates in machine readable form. Possible formats are: YYYY-MM-DD, YYYY-MM, YYYY. Note, that for processing reasons the latter two formats will be mapped to a specific date (i.e. first day of a month/year). Dates may be provided in text form, as well. These dates are then automatically mapped to an ISO-date by means of the web service PDR-WS Dates. Up till now, the PDR-WS Dates web service processes German and Italian dates; a recognizer for English dates is currently under development. ?correspondent=all&startdate=1800-03-01
enddate End date of the time period covered by the query Like startdate, but, analogically, ambiguous dates will be mapped automatically to the last day of a month or year, respectively. ?correspondent=all&enddate=1800-03-01
place Location where the letter was created or received. Requires an ID number from geonames.org as unabridged URL. ?correspondent=all&place=http://www.geonames.org/2879139
placeSender Location where the letter was created. Like place ?correspondent=all&placeSender=http://www.geonames.org/2879139
placeAddressee Location where the letter was received. Like place ?correspondent=all&placeAddressee=http://www.geonames.org/2879139
available Availability of the published letter: online or printed. Possible parameters are online, print, [empty]. In case the parameter is empty or not set at all, letters published both in print or online will be selected. ?correspondent=all&available=online
strictDate Strict date search: Only those letters are retrieved, which were created completely within the indicated date span. This search is opposed to the default search which also retrieves letters created only partially within the searched date span. false (Standard), true ?correspondent=all&startdate=1800-03-01&enddate=1804-12-31&strictDate=true