Most of the REST APIs we use are not actually REST APIs.
They are REST-Like.
A thread on what makes your API purely REST. ๐งต
They are REST-Like.
A thread on what makes your API purely REST. ๐งต
REpresentational State Transfer is the widely used API architecture in use nowadays.
It was originally founded by Roy Fielding in Ph.D. dissertation.
๐ ics.uci.edu
It was originally founded by Roy Fielding in Ph.D. dissertation.
๐ ics.uci.edu
On a broader note, REST API follows six architectural constraints.
โข Client-server Separation
โข Stateless
โข Cacheable
โข Layered System
โข Uniform Interface
โข Code on Demand (optional)
Read more about these in this thread:
โข Client-server Separation
โข Stateless
โข Cacheable
โข Layered System
โข Uniform Interface
โข Code on Demand (optional)
Read more about these in this thread:
Among all the constraints mentioned above, uniform interface emphasizes REST to make it different from other API architectures and styles.
And in fact, a uniform interface is something that makes API REST and REST-Like.
Let's try to understand it first. ๐๐ป
And in fact, a uniform interface is something that makes API REST and REST-Like.
Let's try to understand it first. ๐๐ป
The Uniform interface is a pretty intuitive term.
Uniform means consistent
Interface means what the client sees.
Uniform means consistent
Interface means what the client sees.
The uniform interface defines the interface between client and server, aiming for simplified and decoupled architecture.
In simple terms, intuitive and easy to use API.
In simple terms, intuitive and easy to use API.
Uniform Interface is further divided into four parts.
โข Identification of resources
โข Manipulation of resources through representations
โข Self-descriptive messages
โข Hypermedia as the engine of application state (HATEOAS)
โข Identification of resources
โข Manipulation of resources through representations
โข Self-descriptive messages
โข Hypermedia as the engine of application state (HATEOAS)
The fourth point, HATEOAS is something that makes your API REST-Like or REST.
Let's discuss all four points first ๐๐ป
Let's discuss all four points first ๐๐ป
๐ Identification of resources
Identification of resources can be done by URI and its naming.
Identification of resources can be done by URI and its naming.
๐ Manipulation of resources through representations
We have PUT, PATCH, and DELETE HTTP methods using which we can manipulate the state of resources.
We have PUT, PATCH, and DELETE HTTP methods using which we can manipulate the state of resources.
๐ Self-descriptive messages
Every returned resource should be descriptive so that client can use it efficiently.
This can be achieved by using the `Content-Type` header which indicates the content type of returned resource.
Every returned resource should be descriptive so that client can use it efficiently.
This can be achieved by using the `Content-Type` header which indicates the content type of returned resource.
๐ HATEOAS
This is the most crucial point of this thread and HATEOAS decides whether an API is REST or REST-Like.
This is the most crucial point of this thread and HATEOAS decides whether an API is REST or REST-Like.
HATEOAS stands for Hypermedia As The Engine Of Application State.
Before understanding HATEOAS, we need to learn what is hypermedia.
Hypermedia is nothing but the extension of hypertext that links to different media (image, audio, video, text), especially within an API.
Before understanding HATEOAS, we need to learn what is hypermedia.
Hypermedia is nothing but the extension of hypertext that links to different media (image, audio, video, text), especially within an API.
So if we look deeper into it, we will find that almost every REST API follows:
โข Identification of resources
โข Manipulation of resources through representations
โข Self-descriptive messages
But HATEOAS is something that we do not find in all the APIs.
โข Identification of resources
โข Manipulation of resources through representations
โข Self-descriptive messages
But HATEOAS is something that we do not find in all the APIs.
HATEOAS is not very much hard to implement.
Make sure to implement in your API to deliver pure REST APIs.
Make sure to implement in your API to deliver pure REST APIs.
With that said, this is the end of this thread.
Follow @Rapid_API for more exclusive content about APIs. ๐๐
Follow @Rapid_API for more exclusive content about APIs. ๐๐
Loading suggestions...