What is an API request?
An API request is a message sent by an app to the API asking for a specific service, functionality, or data.
An API request, or an API call, is a message sent by an app to the API (application programming interface) asking for a specific service, functionality, or data. An API request is the first step in exchanging data or functionality through an API. Whenever an app wants to access a feature or data from an outside system using an API, it initiates an API request. API requests work together with API responses to enable applications to share data and provide seamless user experiences.
Once an app creates an API request, it sends the request to the API server using the appropriate communication protocol, such as HTTP (Hypertext Transfer Protocol). The API server receives the request, processes it, and generates the corresponding API response.
Elements included in an API request
Endpoint: The API endpoint is a unique URL that acts as the target for the API request. This URL corresponds with the location of the requested resource and directs the API request to completion.
Request method: Also known as the HTTP method, the request method specifies the type of action to be performed on the resource being requested from among the following functions:
GET: Retrieve data from the server
POST: Submit data to the server for processing or creation of a new resource
PUT: Update or replace an existing resource on the server
DELETE: Remove or delete a resource from the server
Headers: Headers contain additional information or metadata about the request, such as authentication credentials, content type, caching directives, and other API specifics.
Parameters: Depending on the API design, the request may include parameters (or a payload) that provide additional information needed to execute the requested action.
Authentication: To ensure security, an API request may include authentication credentials — an API key, access token, or username/password combination — to validate the identity and permissions of the requesting application.
Response: After receiving an API request, the API processes it and sends back an API response, including the requested data and a confirmation or error message if the request fails.
Say you’re using Sendbird Chat API to retrieve the chat history for a specific conversation. Using the JSON data format, the API request would look something like this:
An API request is the first step in exchanging data or functionality through an API. It works with API responses to enable applications to share data and provide seamless user experiences.
Build your in-app communications without the challenge.