API
What is an API?
What is an API? A Beginner's Guide to APIs | Postman
An API (Application Programming Interface) is a set of protocols that enable different software components to communicate with each other.
Developers use APIs as an abstraction to access software functionality without knowing the underlying implementation details.
How Do APIs Work?
-
API Client
Responsible for initiating communication between the client and the server. -
API Request
The type of request that an API client triggers may vary but generally includes the following components:- Endpoint: A dedicated URL to access a specific resource.
- Method: The type of operation the client wants to perform (e.g.,
GET
,POST
,PUT
,DELETE
). - Parameters: Variables passed into the request to provide specific instructions to the API server.
- Request Headers: Key-value pairs that provide extra detail to the API request (e.g., authentication tokens).
- Request Body: The actual data that the API will create, edit, or delete, depending on the method.
-
API Server
The API client sends requests to the API server, which is responsible for authentication, data handling, and executing the requested operations. -
API Response
The API server sends a response back to the client, which usually contains the following:- Status Code: Indicates the outcome of the request (e.g.,
200 OK
,404 Not Found
). - Response Headers: Provide additional details about the response.
- Response Body: The actual data requested by the client.
REST#How do REST API's work?
- Status Code: Indicates the outcome of the request (e.g.,
API Architectural Styles
- REST (Representational State Transfer)
The most popular API architecture on the internet. Resources are accessible via endpoints, and operations are performed using standard HTTP methods.