External Requests

MetaboAnalyst now accepts compound lists for ID conversion. Please use the API defined below:

POST mapcompounds
  http://api.xialab.ca/mapcompounds

Headers
  Content-Type    application/json

Body    raw (application/json

  {
    "queryList": "1,3-Diaminopropane;2-Ketobutyric acid;2-Hydroxybutyric acid;2-Methoxyestrone;",
    "inputType": "name"
  }

    The different options for input.type are given below:
        name - Compound name (e.g., 1,3-Diaminopropane)
        hmdb - Human Metabolome Database (e.g., HMDB0000002)
        pubchem - PubChem Substance and Compound databases(e.g., 428)
        chebi - Chemical Entities of Biological Interest(e.g., 15725)
        metlin - Metabolite and Chemical Entity Database (e.g., 5081)
        kegg - KEGG COMPOUND Database (e.g., C00986)
                

         
A list of examples for calling mapcompounds using several programming languages is shown below:

JavaScript Jquery AJAX 
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.xialab.ca/mapcompounds",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "cache-control": "no-cache"
  },
  "processData": false,
  "data": "{\n\t\"queryList\": \"1,3-Diaminopropane;2-Ketobutyric acid;2-Hydroxybutyric acid;\",\n\t\"inputType\": \"name\"\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

cURL (command line)  
curl -X POST \
  http://api.xialab.ca/mapcompounds \
  -H 'Content-Type: application/json' \
  -H 'cache-control: no-cache' \
  -d '{
	"queryList": "1,3-Diaminopropane;2-Ketobutyric acid;2-Hydroxybutyric acid;",
	"inputType": "name"
}'

Java Unirest
HttpResponse<String> response = Unirest.post("http://api.xialab.ca/mapcompounds")
  .header("Content-Type", "application/json")
  .header("cache-control", "no-cache")
  .body("{\n\t\"queryList\": \"1,3-Diaminopropane;2-Ketobutyric acid;2-Hydroxybutyric acid;\",\n\t\"inputType\": \"name\"\n}")
  .asString();
  
Python Requests
import requests

url = "http://api.xialab.ca/mapcompounds"

payload = "{\n\t\"queryList\": \"1,3-Diaminopropane;2-Ketobutyric acid;2-Hydroxybutyric acid;\",\n\t\"inputType\": \"name\"\n}"
headers = {
    'Content-Type': "application/json",
    'cache-control': "no-cache",
    }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
            
Processing ....
Your session is about to expire!

You will be logged off in seconds.

Do you want to continue your session?