MetaboAnalystR: Querying PubChem CIDs & HMDB IDs with API in RStudio (Compound Name Mapping)

[MetaboAnalyst](https://MetaboAnalystR Example Code)

Above is the link for the example code provided for compound name mapping through the MetaboAnalyst API in R. I’ve attempted to hit the API with PubChem CIDs & HMDB IDs (individually & with the inputType set to either “pubchem” or “hmdb” individually). The script runs and a status code of 200 is returned, and thus the query is running successfully. That said, no matter the input, the output is NA.

Be sure to remove “flatten = TRUE” near the end of the code when testing.

query_results_text <- content(query_results, "text", encoding = "UTF-8")
query_results_json <- rjson::fromJSON(query_results_text)
results <- data.frame(query_results_json$Query, query_results_json$ChEBI)