Citoid/API

This document describes how to interact with the native API for the citoid service. There is currently publicly available installation of this endpoint at https://citoid.wikimedia.org/api. However, this endpoint is deprecated in favour of https://en.wikipedia.org/api/rest_v1/#!/Citation/getCitation, which uses a different request format. Only the response section in this documentation is relevant for restbase requests.

For developers, you will find this endpoint at http://localhost:1970/api by default.

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

Arguments

 * currently takes URLs, DOIs, PMCIDs, and PMIDs. If the DOI, PMCID, or PMID 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 for any request results coming from Zotero since Zotero does not have this feature. It also may not work if the website does not use the accept-request header in order to determine what language to return the sites in.

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 is guaranteed to be only one citation Object in the Array.

Field names
The   format uses the same itemTypes and parameter names as the   format, with three 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.