top of page

What is REST API and HTTP methods used for REST API

aramiqbal

What is REST API:

To understand the Rest API, lets first start with some terminology:

Ø  API – Application Programming Interface, is a software-to-software interface, it delivers the functionality or information requested without any user interference or without any user getting affected. API’s provide a secure and standardized way for different applications to work together in real time.

Ø  Client – Client is the program requesting the information through API from another program / server. It interacts with different API’s to get content for its page.

Ø  Resource – It is information that the API provides to the client.

Ø  Server – Server is used by the application / program providing information to the client. This application ensures the server has API to interact with the client providing only the information requested, and ensuring the client doesn’t have access to all information with the server.

Now coming back to what is REST API?

REST stands for Representational State Transfer, is a set of guidelines that applications follow while interacting with each other ensuring the integration is simple and easily scalable.

REST API is a type of API that follows the above guidelines


Rules that lay groundwork for an efficient and versatile API:

·        Client-Server Separation – All interactions are initiated by the client; the client and server can only interact in one-way. Servers cannot make request and clients cannot respond; this keeps the 2 parties involved independent

·        Uniform Interface – All requests and responses must follow a common protocol. A uniform interface is a common language for any client to communicate with any REST AP. For most REST API’s, HTTP is the common language used. We will discuss the HTTP methods used in detail later.

·        Stateless – Being stateless means every interaction, and each request and response provides all the information required to complete the interaction.

·        Layered System – In reality, there are more servers involved to complete the transaction between the client and the final information providing server. These in between layers provide security, distribute traffic and other such functionalities.

·        Cacheable – Caching occurs when media is stored on a client’s device when visiting a website. When the client returns, the media gets loaded quickly instead of initiating a new quest with the server. This makes the page more efficient for the end user. REST APIs are created with caching in mind, server decides if the data can be cached and for how long.

 

HTTP Methods use for REST API implementation:

HTTP wasn’t created for REST, but REST adopted this communication protocol as the standard for applications to use.

Without standardized communication, translating requests and responses between software would be a total mess.


REST API uses JSON or XML format for the standardized communications

Below are the 4 most important HTTP methods –


POST

Post method is used to submit data to the server for processing and thus creating brand new resource

 

GET

Get method is used to retrieve data from a server as is

PUT

Put method is to replace an existing resource that the client has with an updated version

DELETE

The DELETE method is used to remove data from a database. When a client sends a DELETE request, it is requesting that the resource at the specified URL be removed.

 
 
 

Recent Posts

See All

Comments


bottom of page