CS4_REST
CS4_REST
Akshaya Ganesan
Assistant Professor[Off-Campus]
BITS-Pilani
Precap
1. Resources
2. Their names (URIs)
3. Their representations
Example URI:
http://www.example.com/software/releases/1.0.3.tar.gz
4. Relationship between URI and Resources • http://www.example.com/software/releases/latest.tar.gz
• http://www.example.com/weblog/2006/10/24/0
• http://www.example.com/map/roads/USA/AR/Little_Rock
Four main properties
• 1. Addressability
• Consider a URI: http://www.google.com/search?q=jellyfish.
• 2. Statelessness
• Application state vs Resource state
• Application state is kept on the client, but the server can manipulate it by sending representation that
describe the possible state transitions.
• Resource state is kept on the server, but the client can manipulate it by sending the server a
representation that describing the desired new state.
• A Representation Describes Resource State
• 3. Connectedness
• HATEOS
• 4. A uniform interface
Key principles
• Everything is a resource
• Each resource is identifiable by a unique identifier (URI)
• Use the standard HTTP methods
• Resources can have multiple representations
• Communicate statelessly
Best Practices
URI,
HTTP Methods,
HATEOAS (Hypermedia)
References
1) Restful Web services, Leonard Richardson and Sam Ruby, 1 st edition published by O'Reilly
Media,
2) REST API Design Rulebook by Mark Massé
Thank You!
In our next session: