While R (and its package ecosystem) provides a wealth of functions for querying and analyzing data, in our cloud-enabled world there's now a plethora of online services with APIs you can use to augment R's capabilities. Many of these APIs use a RESTful interface, which means you will typically send/receive data encoded in the JSON format using HTTP commands.
Fortunately, as Steph Locke explains in her most recent R Quick tip, the process is pretty simple using R:
- Obtain an authentication key for using the service
- Find the URL of the API service you wish to use
- Convert your input data to JSON format using toJSON in the jsonlite package
- Send your data to the API service using the POST function in the httr package. Include your API key using the add_headers function
- Extract your results from the API response using the fromJSON function
Steph provides an example of detecting text language using the Microsoft Cognitive Services Text Analytics API, but that basic recipe should work for most APIs. (API keys for other Microsoft Cognitive Services APIs for vision, speech, language, knowledge and search are also available for free use with your Github account.) There many APIs available for use around the web, and this list of public APIs maintained by Abhishek Banthia is also a useful resource.
Locke Data: R Quick tip: Microsoft Cognitive Services’ Text Analytics API
Nice Article, I would like to suggest https://jsonformatter.org for developer working with JSON.
Posted by: IrisPanabaker | June 13, 2017 at 10:39