Chapter 29 Getting data using APIs

Melissa Bischoff

For my community contribution project I created a tutorial on how to use APIs to get data. API integrations are an easy and useful way to pull data from the internet before resorting to web scraping. A lot of companies and services have APIs available, some are free for public use and some are for paying customers. In my tutorial I did three examples of getting data using APIs - one in R and two in Python. The first example is in R and uses the httr package. It accesses the github job posting API, which does not require authentication. The second example is the same as the first but in Python and uses the requests package. The third example is also in Python with the requests package but uses the Spotify API which does require authentication. The tutorial includes information about what APIs are focusing on the GET and POST method, examples of getting data from APIs with and without authentication, and helpful tricks along the way.

Link to tutorial pdf

Link to Python code

Link to R code