Abstract
Web services are an important development in making data available to clients in a programmatic manner. Rather than displaying results for humans to view on the Web, we can make requests to a Web service in order to get the resulting data directly and then consume it in our applications immediately. An increasingly common architecture for Web services is termed REST and exploits the concept of URLs as resources. We can make general HTTP requests to retrieve, update, modify, and even create resources. The results (and sometimes the inputs) are often formatted as JSON or XML. In this chapter, we look at how we can access REST services from within R, mapping the documentation for the services into requests, converting the results, and developing R functions to provide higher-level interfaces that hide the details of the HTTP and conversion. REST is becoming the dominant mechanism used for Web services which are also becoming very common. REST is not just used for Web services, but is also increasingly used to communicate with regular applications such as NoSQLdatabases and text search engines and we explore these also in this chapter.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Daniel Adler. rdyncall: Improved foreign function interface (FFI) and dynamic bindings to C libraries (e.g., OpenGL). http://cran.r-project.org/package=rdyncall , 2012. R package version 0.7.5.
J. Anderson, Jan Lehnardt, and Noah Slater. CouchDB: The Definitive Guide. O’Reilly Media, Inc., Sebastopol, CA, 2010.
Thomas Bock. R4CouchDB: Collection of R functions for CouchDB access. https://github.com/wactbprot/R4CouchDB , 2011. R package version 0.08.
Jeroen Ooms. opencpu.encode: Encodes R objects to a standardized JSON format. http://cran.r-project.org/web/packages/opencpu.encode/ , 2012. R package version 0.22.
R Core Team. Condition Handling and Recovery, 2012. http://stat.ethz.ch/Rmanual/R-patched/library/base/html/conditions.html .
Leonard Richardson and Sam Ruby. RESTful Web Services. O’Reilly Media, Inc., Sebastopol, CA, 2007.
Wendell Santos. 195 science APIs: Springer, EPA, and NCBI. http://blog.programmableweb.com/2012/03/28/195-science-apis-springer-epaand-ncbi/ , 2012.
Duncan Temple Lang. RGCCTranslationUnit: R interface to GCC source code information. http://www.omegahat.org/RGCCTranslationUnit , 2009. R package version 0.4-0.
Duncan Temple Lang. RAmazonDBREST: REST-based interface to Amazon’s SimpleDB. http://www.omegahat.org/RAmazonDBREST , 2011. R package version 0.1-1.
Duncan Temple Lang. Rffi: Interface to libffi to dynamically invoke arbitrary compiled routines at run-time without compiled bindings. http://www.omegahat.org/Rffi , 2011. R package version 0.3-0.
Duncan Temple Lang. RJSONIO: Serialize R objects to JSON (JavaScript Object Notation). http://www.omegahat.org/RJSONIO , 2011. R package version 0.95.
Duncan Temple Lang. WADL: Programmatically process Web Application Description Language documents. http://www.omegahat.org/WADL , 2011. R package version 0.2-0.
Duncan Temple Lang. XML: Tools for parsing and generating XML within R and S-PLUS. http://www.omegahat.org/RSXML , 2011. R package version 3.4.
Duncan Temple Lang. Zillow: Simple interface to Zillow.com’s house price estimate API. http://www.omegahat.org/Zillow , 2011. R package version 0.1-1.
Duncan Temple Lang. RCurl: General network (HTTP, FTP, etc.) client interface for R. http://www.omegahat.org/RCurl , 2012. R package version 1.95-3.
Duncan Temple Lang. RGoogleDocs: Primitive interface to Google Documents from R. http://www.omegahat.org/RGoogleDocs , 2012. R package version 0.7-0.
Duncan Temple Lang. SSOAP: Client-side SOAP access for R. http://www.omegahat.org/SSOAP , 2012. R package version 0.9-0.
Duncan Temple Lang. XMLSchema: R facilities to read XML schema. http://www.omegahat.org/XMLSchema , 2012. R package version 0.7-0.
Duncan Temple Lang and Roger Peng. RAmazonS3: R interface to Amazon’s S3 storage. http://www.omegahat.org/RAmazonS3 , 2011. R package version 0.1-5.
Eric van der Vlist. XML Schema. O’Reilly Media, Inc., Sebastopol, CA, 2002.
Zillow, Inc. Zillow: A free online real estate marketplace. http://www.zillow.com/ , 2012.
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2014 Springer Science+Business Media New York
About this chapter
Cite this chapter
Nolan, D., Lang, D.T. (2014). REST-based Web Services. In: XML and Web Technologies for Data Sciences with R. Use R!. Springer, New York, NY. https://doi.org/10.1007/978-1-4614-7900-0_10
Download citation
DOI: https://doi.org/10.1007/978-1-4614-7900-0_10
Published:
Publisher Name: Springer, New York, NY
Print ISBN: 978-1-4614-7899-7
Online ISBN: 978-1-4614-7900-0
eBook Packages: Mathematics and StatisticsMathematics and Statistics (R0)