External Requests

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

POST mapcompounds
  https://www.xialab.ca/api/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": "https://www.xialab.ca/api/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 \
  https://www.xialab.ca/api/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("https://www.xialab.ca/api/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 = "https://www.xialab.ca/api/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)
            
NSERC CRC CFI TMIC Genome Canada Genome Quebec NIH