API

The API Command documentation for UniChem 2.0

Introduction

The UniChem API has moved from a GET method to a POST method. With GET, all the information for the request is encoded in the URL. With POST, variables are sent separately to the URL. For those who wish to keep using old-style APIs, we have replicated the old GET methods for InChI Key search, verbose InChi Key search and source search by source ID.

The new API has interactive documentation available here. Its example requests are provided in as cURL commands. If you wish to convert these to API calls for a specific programming language, we have found Curlconverter to be useful for this. A JSON file describing the 2.0 API is available here.

Example command

curl -X POST "https://www.ebi.ac.uk/unichem/beta/api/v1/compounds" -H "accept: application/json" -H "Content-Type: application/json" -d "{ "compound": "RYYVLZVUVIJVGH-UHFFFAOYSA-N", "sourceID": 1, "type": "inchikey"}"

Anatomy of a command

curl

Program used to retrieve data from a URL.

-X POST "https://www.ebi.ac.uk/unichem/beta/api/v1/compounds"

API endpoint to use.

-H "accept: application/json"

Defines what content type the API will be taking as an input.

-H "Content-Type: application/json"

Defines what content type the API will be giving back.

-d "{

\"compound\":\"GZUITABIAKMVPG-UHFFFAOYSA-N\",

\"sourceID\": 1,

\"type\": \”inchikey\”

}"

JSON input to the API.

Last updated