Get API data with R

No R package for the API you want? It’s easy to write your own function with the httr and jsonlite packages.

Get API data with R

There are a lot of great R packages that let you import data from an API with a single function. However, sometimes an API doesn’t have an already-written function. The good news is that it’s easy to code your own.

I’ll demonstrate this with the AccuWeather API, but the process and code will work for most other APIs that use a key for authentication.

Sign up for API access

If you want to follow along, go to and sign up for a free account. Under Packages and Pricing, select the Limited Trial, which allows 50 API calls per day — enough if you just want to check your local forecast a couple of times a day, but obviously not for any sort of public-facing application.

To continue reading this article register now

How to choose a low-code development platform