[BioC] Using RCurl and XML to access an API

Hervé Pagès hpages at fhcrc.org
Mon Sep 14 22:04:26 CEST 2009

Hi Aaron,

This kind of operations (retrieving XML docs from the web
and parsing their content) is at the heart of some Bioconductor
packages like biomaRt or rtracklayer:


Maybe you could have a look at how things are done in those
packages so you get an idea of how that works.


Aaron Wolen wrote:
> I'd like to access an API from within R but I'm not sure how to do so. The
> API uses HTTP and supports both POST and PUT methods. I'm able to access it
> successfully from the terminal using the following curl command:
> curl --data @genes.xml http://api-url
> Where genes.xml is a local file containing the genes I want to submit and
> http://api-url is the API's address. However, I'm not sure how to replicate
> this command in R. The request payload and response payload are both XML
> streams, so I'm fairly certain this will require a combination of the RCurl
> and XML packages, but I've had no luck getting RCurl to work. I'd really
> appreciate some help with this.
> Thanks,
> Aaron
> 	[[alternative HTML version deleted]]
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor

Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M2-B876
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages at fhcrc.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319

More information about the Bioconductor mailing list