The term API is often thrown around and I know for most people API’s are a buzzword thrown around in meetings to make people sound smart…

API is an acronym, and it stands for “application programming interface”.

The easiest way to reason about what an API is is to think about the interface part. A regular old website is an interface that we use that has actions we can and can’t take, this is a normal interface that most of us are used to these days. We can’t just hope for a result when we click randomly on the screen. We have buttons and other things on the screen so that we can easily understand what actions we can take. When we click a button, for instance, we usually get feedback to tell us an action did what we expected.

An API has different users in mind. Instead of having a nice website with obvious actions and results, apps and software interface with API’s using code. Think of this as when you are travelling, and you need to bring a power adapter with you that fits the local plugs. API’s are like an assortment of plug sockets that instead of electricity pouring out when you plug in the right adapter, we get data or at least a way to interact with that data. API’s give applications a way to interact with databases and even other API’s without the user needing to know all the magic going on behind the scenes (just like you don’t question the source of the electricity every time you plug into the socket in a wall).

So an API is a way for one application to share data with another application.

Now to make an obvious mental image of this, let us go back to the plugs example. If you have the wrong plug, you can’t get the electricity or use the socket. You have a particular way that you can use a socket. If you are not using it properly, you will get an error just like you may feel the error if you put a screwdriver into the socket. You will probably gently reminded that it is not the way the socket is supposed to be used and that immediate feedback is a reminder (and I bet next time you will stick to a suitable socket). So API’s can give errors back when used wrong just like when we misuse an electrical socket. Just like the electricity providers have an intended use of the plugs (like wiring them to your own meter and not your neighbours) this adds structure and reliability. API’s are similar because we only want certain pieces of data available to the outside world when we use it for security to get expected outcomes.

With an API, we don’t want to expose all sensitive data or the database, we want to expose the required data as needed safely. Just like the plug socket protects you from live electricity, the structure of an API protects the inner workings of the API and only exposes the pieces that are meant to be exposed.

The most common sort of API that we use on a day to day basis is a REST API, and I will use that as an example of how we use an API.

In this video, we will look at the data that comes back when we use the TrustPilot API.

#api #web-development #javascript #python

A Beginners Guide to API's | What Is an API?
4.20 GEEK