Rest Api's

Rest Api's

REST API’s :

REST – Representational State Transfer

REST Defines an Guideline how Client and Server can exchange the Representational State of data so its to full fill the Requirements of an Application

Guidelines :

Client Server Architecture

Cacheable

Layered

Stateless

Uniform Interface

Code on Demand

State Transfer & Stateless :

State Transfer – Refers to an State of Data , the data that’s been exchange between Client and Server its happening through REST API’s

Stateless – One Server doesn’t know about the Multiple Clients , Server is Unknown to State of the Client Request Hence Stateless

Path & Query Parms :

Path Parameters :

URI : /mystore/books/12445(ID of the Book) – This is called Path Parameter

Its actually defines if you are looking for an Particular Resource its called Path Parameters

Query Parameters :

URI : /mystore/books ? Limit=20 & offset=0 – This is called Query Parameter

This Query Parameter tells the URI I need an 20 books to display on my UI first page , next time navigate to 2nd page the offset become 1 so at this page also have to display 20 books

HTTP STATUS CODES :

200 – OK

201 – Created (POST)

300 – Redirection (Exist In some other location not in the location where you are trying to access)

400 – Client Error (Bad Request)

409 – Conflict (Client is creating the data which is already exist)

412 – Data format is wrong

500 – Internal Server Error