UniChem 2.0
New Unichem 2.0 Docs
  • Introduction
  • What's new?
  • Web application
    • Compound Sources Search
    • Connectivity Search
    • Similarity Search
    • Query field requirements
  • API
    • Sources
    • Compound Search
    • Connectivity Search
    • Legacy
  • Downloads
  • Submission of data to UniChem
    • Reasons for data omission
  • Getting in touch
  • Citing UniChem
  • FAQs
  • Definitions
    • What is an Assignment?
    • What is meant by a 'src_id' and a 'src_compound_id' in UniChem ?
    • Glossary of Terms
  • Data protection: Privacy notice for UniChem's public website
Powered by GitBook
On this page
  • Introduction
  • Example command
  • Anatomy of a command

Was this helpful?

API

The API Command documentation for UniChem 2.0

PreviousQuery field requirementsNextSources

Last updated 3 years ago

Was this helpful?

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 . 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 to be useful for this. A JSON file describing the 2.0 API is available .

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.

here
Curlconverter
here