API

Note: The API for modifying the contents of the database is currently very limited.

There is an API for asking the server to fetch publication data from PubMed or Crossref given a PubMed identifier (PMID) or Digital Object Identifier (DOI).

Note that the API call fetches only one publication at a time.

Here is an example of client code using the third-party package requests for HTTP interaction. base_url is the base URL for the Publications server, and apikey is the API key that can be set for for your account.

base_url = "https://publications.scilifelab.se"
apikey = "5df4314c3d22467aad2a9ceb0d8b895e"

url = f"{base_url}/api/publication")
headers = {'X-Publications-API-key': apikey}
data = dict(identifier=identifier, override=override, labels=labels)

response = requests.post(url, headers=headers, json=data)

if response.status_code != 200:
    raise ValueError(f"Error {response.status_code}: {response.reason}")
else:
    return response.json()['href']