2019 Unit1 Lecture6 REST
2019 Unit1 Lecture6 REST
Dinkar Sitaram
Prof K V Subramaniam
Prof Ramesh Bhat
Prof Nirupama MP
Prof Samatha RS
CS352: REST
Source: Learn Rest in 18 slides, Suraj Gupta, OBeautifulCode.com, 2014
REST
Why Learn Rest
▪ Is it a standard?NO
REST is a programming style
▪ An example protocol that uses REST –
▪ HTTP can also be used in a non-RESTful way
Example: SOAP services that use http to transport data
Familiarity Check
▪ Resource is a “Thing”
▪ You need to give an identifier for a “thing”
▪ Take for example “light on board in the
seminar hall”
▪ If you need to control it, you need to name it.
▪ For example
/pesu/b-block/groundfloor/seminarhall/board/light/1
▪ Resources ▪ Representation
Books Accept: text/JSON
Recommendations
Shopping Cart
Friend
Representations..
▪ REST mandates
State be turned into
resource state or
Client takes care of
state
▪ Server will not
maintain any
communication state
for a client
▪ Each client request is
treated independently
Statelessness - Benefits
No state saved on
server, so even if
▪ Clients isolated server fails, the client
connects to another
against changes on server and continue
server
▪ Promotes redundancy
- unlocks performance
don’t really need to
know which server
client was talking to
No synchronization
overhead
Errors