What is an API?
An API (Application Program Interface) is a set of rules that enables different programs to communicate with one another. It is a mechanism that enables an application or service to access a resource within another application or service.
What is a resource?
A resource can be any information that could be named, such as a document or image, a collection of other resources, a non-virtual object, and more.
· The application or service doing the accessing is called the client.
· The application or service containing the resource is called the server.
What is REST API?
A REST API is an API that conforms to the design principles of the REST, or representational state transfer architectural style. REST uses a resource identifier to recognize the specific resource involved in an interaction between components.
Rest API Architecture
How do REST APIs Work?
REST API uses methods to communicate with the server.
The four main resource methods that are associated with REST APIs are:
GET: This request is used to get a resource from a server. If you perform a GET request, the server looks for the data you requested and sends it back to you.
POST: This request is used to create a new resource on a server. If you perform a POST request, the server creates a new entry in the database and tells you whether the creation is successful.
PUT and PATCH: These two requests are used to update a resource on a server. If you perform a PUT or PATCH request, the server updates an entry in the database and tells you whether the update is successful.
PUT updates the complete row whereas, PATCH updates or modifies only part of the row.
DELETE : This request is used to delete a resource from a server. If you perform a DELETE request, the server deletes an entry in the database and tells you whether the deletion is successful.
Comments