Definition of API
API stands for Application Programming Interface and refers to a set of programming instructions that allows two applications to have interaction to each other.
When you search something on Google, an API tells Google about what you have searched and Google will display the results regarding on your search. In other words, an API sends the client request to the server and then the server response back to the client once the server received it already.
The developer can also make a certain “call” or “request” to the server using an API. JSON and XML are used for accessing the data over API. When the data is already received, the developer will need to cross through XML or JSON to fully understand what the server sent. Updating and deleting the data can be also made with API request. Below are the four basic requests methods can be made using API:
- POST – Create
- GET – Read
- PUT – Update
- PATCH – Partial Update/Modify
- DELETE – Delete
Real life examples of API
Let’s say you are sitting in a restaurant and you have the menu of choices available in the restaurant. Once you already choose what you want, the waiter comes up and you tell the waiter about your order and the waiter takes note of it. The API or messenger is the waiter that takes your requests and tells the kitchen (server) to prepare your food. Once your food (response) is ready made from the kitchen (server), the waiter (API) will deliver that back to you. In this case, the waiter is the middleman between you and the kitchen. The waiter’s responsibility is to bring your request to the kitchen and once it’s ready, he gets the response back to you.
Booking Tickets Online
Another real-life example is booking flights online. You have a variety of choices including different cities and you can also choose desired departure date and time same with the return date and time, the process is similar on the restaurant. Example when you about to book tickets online, you need to choose your desired destination, departure date and time, return date and time and more information you need to choose. With this, you are now interacting with airline’s website using API. When you already choose your desired destination with departure and return date and time, the website will give you list of available seats and also show you what would be the cost.
Importance of API
API is a powerful tool for businesses in all industries. API allows businesses to grow rapidly because they are able to put their data to create new business opportunities and improve existing products, systems, and operations. The importance of API from a developer is they don’t need to begin from the scratch to make core application to do everything every time they write a new program. Instead, they can able not to do certain responsibilities by using already created pieces that do the job better. Also, they allow the capabilities of one computer program to be used by another. API is a way to make two different programs to have communication.