Every once in a while, people encounter a term that makes them think something is so far above their head, they’ll never understand it. APIs are often one of these things… and the belief is often baseless.
Application Programming Interfaces, or, APIs, are the primary method of connecting software with other pieces of software. That sounds complex, but really, it’s no different than visiting a website (in fact, browsing the web is a more advanced version).
Most computer users are accustomed to interacting with computers via Graphical User Interfaces (GUIs). APIs strip down all of the visuals to strictly focus on the information being transmitted. A great example of this — even if you’re not a transportation person — is SEPTA’s TrainView, which displays statuses for trains. If you visit the TrainView page for, say, Train 516, you’ll see the train’s scheduled and actual times. Now visit the API page for Train 516’s status. What you find is the same information, stripped of the images and limited strictly to the core data you’re seeking. That’s it! You just used an API!
What else do you need to know about APIs?
- Every time you interact with an API, you’re “making a call.” Think of it as your computer connecting with some other computer to perform an action.
- There are four main actions, and thus four main request types, that an API can perform. Using the train example:
- GET gets information, such as the train information for Train 516 (performing a get request).
- POST adds information, such as if we were to tell SEPTA of a new train they’re running.
- UPDATE updates information, such as telling SEPTA a train is now late.
- DELETE removes information, such as telling SEPTA to remove the train we added.
- Many APIs require the use of an API Key, which is essentially a key for you to access the API. Most frequently this takes the form of a random alphanumeric string, which you can get by registering for a site.
- Postman is a great tool for interacting with APIs. Yes, it’s a little difficult to understand at first, but it makes it quite easy to query APIs and then ultimately convert that request to various programming languages.
Looking for an easy API to use? Check out the weather API by Dark Sky. Not only is it well documented, it’s fairly interesting, understandable, and has a quick setup time.
This is an admittedly simple view of APIs; they can indeed be much more complex. But at their core, this explains what they are, how they’re used, and how you can get started.