Understanding, consuming, and building APIs and data
Prerequisite: understand how the Internet works, how apps make and respond to requests, and other essential networks.
APIs, or application programming interfaces, are kind of hard to define. In the context of web development, APIs denote websites that accept requests through HTTP (the same process as when you type a URL into your browser and hit ‘Enter’, only through code), and respond back with JSON containing your requested information. Open APIs in this case means essentially databases that you can access via a programming interface.
To understand the concept behind using APIs to get information from a server, read Thoughtworks’ great post on REST API design and resource modeling.
Here’s a small tutorial I wrote on how to use Ruby to access an API.
Check out Rise of APIs, a cool article talking about the current status of APIs.
Code you’ll need to make API calls
- Net::HTTP Cheatsheet, best short-and-sweet support for making raw HTTP requests with Ruby, no framework required.
- HTTP Calls with Ruby
- unirest, helping you make very clean http requests without the headache of Net::HTTP syntax.
- “A practical guide to fetch(), reduce() and formatting data from an external API”
- You’ll need to understand CORS (cross-origin resource sharing). We have resources on that on our networking basics page.
Open data to use
- Unsplash’s API, a gorgeous collection of free photos to use, that you can request via an API.
- FreeCodeCamp’s Coder Survey data
- open NASA data API
- Datamuse, a very simple API providing words and language data based on queries: rhymes and more!
- NYC open data API
- Open US government data API
- UK government data API
- NYTimes APIs
- NYTimes books API
- Google books API
- Haven OnDemand APIs: for data cleaning and analysis, like Sentiment Analysis for text!
- IBM’s Watson API catalog: APIs for the “cognitive era”.
- The Imgur API, making API calls to Imgur.
- Reddit: while it has an official API, you can also append
.jsonto any Reddit post page to get that page as JSON data.
- Eventful, an API for events.
Sites that are API directories
- Programmable Web, a ton of open APIs featuring ability to search through them.
- Marketplace Mashape, a gigantic bunch of public APIs.
- A compiled list on Github of public APIs: check it out here.
Data analysis, graphing, and more.