Citoid/API

This document describes how to interact with the native API for the citoid service. However, in production we are running citoid behind restbase, which uses a different request format, for which the documentation can be found at https://en.wikipedia.org/api/rest_v1/#!/Citation/getCitation. Only the response section in this documentation is relevant for restbase requests.

Locally a version of this documentation can be found at http://localhost:1970/?doc.

Requests
The API endpoint accepts GET data. In the GET request, three arguments are accepted:  and.

Arguments

 * currently takes URLs, DOIs, PMCIDs, and PMID, ISBNs, QIDs, and fully formatted citations / free text search. If the unique identifier is unresolvable, you will get back a 404 response and a JSON error message.


 * takes   ,   , and  .  is the format used by the zotero service, and is the format that citoid uses internally.   is the targeted format, and is designed for use by TemplateData maps found in citation templates. You may find, depending on your use case, for the    format to be richer.  The format   is largely the same as   , but will return the base fields for the data in instead of the mapped fields. For example, it will return   instead of   or.

Headers
To try to request a website in a particular language, you can set the  header in your request, and citoid will attempt to retrieve the website in that language.

This will not work if the website does not use the accept-request header in order to determine what language to return the sites in or if the requested language isn't available (which is often.)

Successful response in mediawiki format
A successful (200 ok) citoid response for the   format consists of an Array of citation Objects,   in the body. At present, there will be only one citation Object in the Array if you do not have a WorldCat key / if the wskey option is turned off. If you have enabled WorldCat requests and have a wskey (this is the case in production), then you can receive up to 2 results with a free text search only. These results consist of the top result from crossref simple text query (journal articles and other resources with a doi) and the top result from WorldCat OpenSearch (books and other resources with an ISBN). Requests for a URL or other unique identifier will return only one result.

Field names
The   format uses the same itemTypes and parameter names as the   format, with four additional parameters: ,  ,  , and. A nearly complete list of all itemTypes possible and each itemType's respective parameters are available from Zotero here.

Parameters for which there is no value will not be included in the response. There are three required parameters that will always be returned: ,   and.

Parameters which are written in parentheses on the Zotero type map are called basefields. By default, you will get the first parameter name. You can request the basefield instead as a query parameter in the request.

Field values
The values for most fields are Strings. The value of the fields ,  ,   ,   and    are Arrays of Strings. The value of any  type (i.e. ,  ,  , etc.) is an Arrays of Arrays, i.e..

The possible String values in the Array  are: ,  ,  , and. This indicates where the metadata was retrieved from.

Unsuccessful response
Alongside regular errors (400 Bad Request), we have a custom 520 response that returns a citation object even if no data is able to be retrieved.

Sample output
Below are sample outputs of two of the export formats. The primary difference is in how creators/authors/editors are handled. In, these are all in the   object, and in   they are in a list of   lists keyed by the creatorType value. In only, ISBN and ISSN are lists.