API Call Definition
API calls can be described as messages exchanged between a customer and a service. It’s a vital part of an API (Application Programming Interface) because, without the means of communication, customers wouldn’t be able to send their requests, and servers wouldn’t reply to them.
Sending an API call basically means asking an API to provide information or perform the service. In a non-digital world, an API call could be compared to ordering a pizza via phone. The customer calls a pizza place, and it replies with… the pizza.
In a digital world, though, customers can order pizza via the website or mobile app. During the process, they literally make API calls, because the software hidden under the front-end part of the pizza place website is based on API.
The journey of an API call
An API call is a signal, so – to work as expected – it needs to reach the destination. The destination of an API call is called an endpoint. In most cases, that would be a server.
The whole process looks similar to this:
- A customer clicks a button in an application to get the information they need;
- The program sends an API call to the endpoint with an information request;
- An endpoint receives the call and proceeds it either by retrieving data from its own resources or by pushing the request further.
- The requested piece of information is being delivered back to the customer application.
- The customer receives the result of an API call.
Of course, the description above is simplified, as it only scratches the surface of making API calls. So let’s break it down.
API call – related terms
You need to learn a few terms to understand API calls properly. One of them is URI (not to be confused with URL):
URI (Uniform Resource Identifier) is the server’s address. To successfully make an API call, a customer needs to know a URI to send their request to the desired target.
API calls come in different types – there are four of them:
- GET – this type of an API call allows applications to acquire information or a resource;
- POST – sending a POST API call sends out data to create a new resource or to update an existing one.
- PUT – it also allows you to create, replace or update a resource, but it also overwrites the whole resource.
- DELETE – no further explanation is required, as the DELETE API call deletes the resource.