0% found this document useful (0 votes)
4 views

CS4_REST

The document provides an overview of Service Oriented Computing with a focus on REST (Representational State Transfer) principles, including key properties such as addressability, statelessness, connectedness, and a uniform interface. It outlines best practices for URI design and HTTP methods, emphasizing the importance of resource representation and communication. Additionally, it introduces the Richardson Maturity Model for assessing the maturity of RESTful services.

Uploaded by

mohit
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

CS4_REST

The document provides an overview of Service Oriented Computing with a focus on REST (Representational State Transfer) principles, including key properties such as addressability, statelessness, connectedness, and a uniform interface. It outlines best practices for URI design and HTTP methods, emphasizing the importance of resource representation and communication. Additionally, it introduces the Richardson Maturity Model for assessing the maturity of RESTful services.

Uploaded by

mohit
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Service Oriented Computing

Akshaya Ganesan
Assistant Professor[Off-Campus]
BITS-Pilani
Precap

• Introduction to REST (Representational State Transfer)


• REST architectural style
• REST constraints
Agenda

• REST and Resources


• Addressability
• Statelessness
• Connectedness
• Uniform Interface
REST is about…

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

Use only nouns for a URI;


GET methods should not alter the state of resource;
Use plural nouns for a URI;
Use sub-resources for relationships between resources;
Use HTTP headers to specify input/output format;
Provide users with filtering and paging for collections;
Version the API;
Provide proper HTTP status codes.
Example

• The browser makes an HTTP request:


• POST /messages HTTP/1.1
• Host: www.youtypeitwepostit.com
• Content-type: application/x-www-form-urlencoded
• message=Test&submit=Post

• And the server responds with the following:


• HTTP/1.1 303 See Other
• Content-type: text/html
• Location: http://www.youtypeitwepostit.com/messages/5266722824890167
REST Maturity Model
Richardson Maturity Model (martinfowler.com)
Richardson used three main factors to decide
the maturity of a service. These factors are

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:

You might also like