Web Development

APIs (Application Programming Interface)

black smartphone near tablet computer on white surface

“An Application Programming Interface (API) is a set of commands, functions, protocols and objects that programmers can use to create software or interact with an external system.
It provides developers with standard commands for performing common operations so they do not have to write the code from scratch.”

Above is a very broad definition of APIs, let’s break it down to see various parts of and API and how it works in practice.

If we take the first part, where states API is a set of commands, functions, protocols and objects that programmers can use to create software, jQuery is actually an API that provides a bunch of methods that allow us to create software more efficiently. This is a form of API that developers use to create software.

However, what people tend to mean why they talking about API are APIs that are used to interact with an external system. A common use case is for instance, we have a dating app that matches people up by the things they’ve liked on Facebook. We need the data from Facebook in order to do this, thus, we make a get request to Facebook server from our server, and Facebook will send a response back with all of that data we need in order to populate our app.
This is one of the most common ways of using APIs, which is to interact with an external source.

Nevertheless, when we are doing this, we cannot just go into somebody else’s server and make a request, we have to do it through an API, this interface determines what are the things that we can request from their server and how should we do it.

Although different websites work differently, here’s a big picture of what usually take place.

Effectively, your server is making a request via the API to somebody else’s server, and you can pass in some parameters as inputs, and their server is interacting with their database in order to grab the data you need based on your request, and your parameters. Once it has gotten the data, it will send back through the response, and you will end up with the data you wanted from their database.

Standard