return to list of articles

The API in layman's terms

These days, most web services have an API. The word is thrown around a lot and a lot of non-technical people don't really understand what an API is. Firstly, know that it stands for an Application Programming Interface. The interface bit should tell you that it allows for some sort of interaction, which is right, it allows a piece of software to interact with another piece of software. An example would be an application you use that lets you see your tweets from Twitter, so I'll use Tweetdeck for this example.

The Twitter platform has this API that defines a set of rules or methods about how other software can interact with it to get specific information (such as your tweets). Your piece of software communicates with this interface by "talking" in the different methods. The information is accessed and sent to your application where you access it, instead of using the main Twitter website.

Consider the following analogy:

You're in a certain car, and you'd like to get from your house to the tax offices to submit your tax returns because your internet is down and you can't do an electronic submission. The engine, wheels and axles (for the sake of simplicity) get you to the tax office, but it can't do so without certain rules - You need to drive it on a road. Let's remember that the tax building is a government building (we consider this because the government builds and owns roads), and they provide you with an interface to get to them - the road architecture.

 

You need this interface to drive to the government building, and you need to follow the rules they've set up when they built it (stop signs, speed limits etc.) to use it. Having a client (your car) and an API (the road), you have an alternative way to send your returns that doesn't consist of using the internet. Remember that there are many cars on the road that can be used to get there.

So much like you use your car to interface with the road to get you to the tax office, Tweetdeck interfaces with Twitter's API to get the information that is readily available and exposed in Twitter's data environment to you, outside of Twitter.com. Also note that Tweetdeck is a specific client that follows the API constraints, but it isn't the only client that can use it. There's also Tweetie, Echofon, UberSocial etc. (Much like there are many Fords, Hondas and BMWs on the road).

Another thing worth remembering is that APIs always expose data, as in everything is always available and you use methods (certain commands) to ask the API what that data is, and replicate it in your client. Some APIs require access tokens (sticking with the analogy, only buses are allowed in bus lanes) to access certain data methods.

Also, if there are a lot of cars on the road, the traffic is slow. If lots of clients are accessing a web service's API, there can be quite a bit of lag.

I hope that helps you understand how APIs work.


Get notified when Pawel releases new posts, guides, or projects