SlideShare a Scribd company logo
Gran Sasso Science Institute
Ivano Malavolta
REST
Roadmap
The REST Architectural Style
Resources
Representations
Actions
REST
It stands for
REpresentational
State Transfer
Proposed by Roy Fieldings
in his PhD dissertation in 2000
REST rules the architectureof
the World Wide Web (HTTP)
Major players
REST Architectural Style
REST is neither a technology nor a framework
REST is an ArchitecturalStyle
à a set of principles + constraints
Those constraints help us in developing applicationsthatare
“easy” to maintainand extend
REST Main Constraints
A RESTful system
• is client-server
• is stateless
– there should be no need for the service to keep users’
sessions
– each request should be independent of others
• has to support a caching system
• has to be uniformlyaccessible
– each resource must have a unique address and a validpoint
of access
The (static) Web as a RESTful system
1. you type a URL into your browser to reach a specific HTML
page
2. the browser gets and displays the elements of the HTML page
à the browser is getting a representationof the currentstate
of that resource
REST Main Actors
These are the abstractionsthatmake a RESTful system:
• Resources
• Representations
• Actions
Roadmap
The REST Architectural Style
Resources
Representations
Actions
Resources
A resource is “everything”the service can provide
Statesand functions of a remote applicationarealso considered
as resources
Example of resources:
• titleof a movie from IMDb
• a Flash movie from YouTube
• images from Flickr
• order info from eBay
• etc.
Resources
In general, a RESTful resource is anythingthat is addressable
over the Web
Addressable = anythingthatcan be accessed and transferred
between client and server
à a resource must have a unique address overthe Web
Under HTTP these are URIs
URIs
UniformResource Identifier
in a RESTful web service is a hyperlinkto a resource
It is the only means forclients and servers to exchange
representationsof resources
ex.
.../orderinfo?id=123
URIs
The URI is not meant to change over time
à it is the only means to identify a specific resource
URIs are also used to negotiaterepresentations of a given
resource
In the URI you give certainparameters thatdefine which
informationyou wantthe server to returnto you (just like
giving GET variablesto a page)
The server will respond with a resource representation
containingthe information you’veasked
Roadmap
The REST Architectural Style
Resources
Representations
Actions
Representations
The representationof resources is whatis sent back and forth
between clients and servers
So, we neversend or receive resources, only theirrepresentations
URL
UniformResource Locator
A URL is a specializationof URI that defines the networklocation
of a specific resource
Unlike a URI, the URL defines how the resource can be obtained
es.
http://some.domain.com/orderinfo?id=123
URL
URIs and URLs are also used to link resources together
ex.
Representations
The formatof the representationis determined by the content-
type
The interactionof the representationon the resource is
determined by the action (GET, SET,etc.)
Content-types
Since we are using HTTP to communicate,we can transferany
kind of informationthatcan be passed between clients and
servers
ex. text files, PDF documents, images, videos, etc.
In anycase, the data is streamed over TCP/IPand the browser
knows how to interpretthe binary streams because of the
HTTP protocolresponse header Content-Type
Representation Formats
Different clients are able to consume differentrepresentations
of the same resource
A representationcan take various forms, such as:
• image
• a text file
• an XML stream
• a JSON stream
but its resource has to be availablethroughthe same URI
Representation Formats
For human-generated requests through a web browser, a
representationis typicallyinthe form of an HTML page
For automatedrequests from other web services, readabilityis
not as importantand a more efficient representationcan be
used such as XML or JSON
Roadmap
The REST Architectural Style
Resources
Representations
Actions
Actions
Actions are used to operate on resources
For example, they can be usedfor
– getting info about a movie
– addinga photo to Flickr
– deleting a file from a folder
The datatransmitted to and from the resource is a representation
of it
HTTP-based Actions
Under HTTP, actions are standardHTTP request:
GET
POST
PUT
DELETE
They make up the uniform interfaceused for client/serverdata
transfers
HTTP-based Actions
RESTful web services can also execute logic at the server level,
but remember thatevery result must be a resource
representation
HTTP as Uniform Interface
In RESTful systems we focus on resource names, whereas in
traditionalweb systems we focussed on the actions to be
performed on resources
à In RESTful systems we have fourspecific actionsthat we can
take upon resources — Create,Retrieve, Update,and Delete
(CRUD)
In traditionalweb applications,we could have countless actions
with no naming or implementationstandards
The Classroom Example
Artificialexample of a web service handling students in some
classroom
Locationof the service = http://restfuljava.com/
Resources are represented as XML streams
The Classroom Example: URIs
Student (identified by name):
http://restfuljava.com/students/{name}
List of students:
http://restfuljava.com/students
The Classroom Example: Representations
Student:
<student>
<name>Jane</name>
<age>10</age>
<link>/students/Jane</link>
</student>
The Classroom Example: Representations
Students List:
<students>
<student>
<name>Jane</name>
<age>10</age>
<link>/students/Jane</link>
</student>
<student>
<name>John</name>
<age>11</age>
<link>/students/John</link>
</student>
</students>
GET
The method GET is used to RETRIEVE resources
It cannot have side-effects
àit can be done repeatedly withoutchanging the state of the
resource
It can also returnonly parts of the resource
à it can act as both a read operation and a query operation
GET Example
POST
The method POST is used to CREATE resources
Usually,the resource identity/URLis not known at creationtime
à The URL of the newly createdresource is usually created
automaticallybythe server
POST Example
PUT
The method PUT is used to UPDATE resources
Recurrent PUT workflow:
1. we firstGET the representationof the resource we need to
update
2. in the client we update the resource with the new value(s)
3. we update the resource using a PUT request togetherwith
the representationas its payload
PUT Example
The initial GET
is omitted here
DELETE
The method DELETE is used to DELETE resources
SimilarlytoPUT, also in this case we need the URI of the resource
being deleted
DELETE Example
A note on PUT and DELETE
PUT and DELETE apply to the entire resource
à when doinga PUT or DELETE operation,
the entire resource is replaced/deleted
The PUT and DELETE operations are atomic
à if two PUT/DELETE operations occur simultaneously,
one of them will win and determine the final state of
the resource
HTTP Status Codes
RESTful services use these codes to return informationaboutthe
response of the requests
1xx informationalmessage
2xx success message
3xx redirectsthe client to another URL
4xx client-side error
5xx server-side error
LAB
Extend the app of the previous labs so that products and
producers are real data coming from the Loveitaly VM
Another example of Rest API: http://www.nestoria.co.uk/help/api
http://api.nestoria.it/api?place_name=laquila&encoding=json&pretty=1&listing_type=buy&country=it&action=search_listings
References
http://bit.ly/JA1UPT
CordovaFacebook plugin:
http://goo.gl/7qY54
Facebook login withoutplugin:
http://github.com/ccoenraets/OpenFB
Contact
Ivano Malavolta |
Gran Sasso Science Institute
iivanoo
ivano.malavolta@gssi.infn.it
www.ivanomalavolta.com

More Related Content

What's hot

Dataweave
DataweaveDataweave
Dataweave
krishashi
 
MVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVCMVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVC
Anton Krasnoshchok
 
Frameworks Galore: A Pragmatic Review
Frameworks Galore: A Pragmatic ReviewFrameworks Galore: A Pragmatic Review
Frameworks Galore: A Pragmatic Review
netc2012
 
Session 36 - JSP - Part 1
Session 36 - JSP - Part 1Session 36 - JSP - Part 1
Session 36 - JSP - Part 1
PawanMM
 
Session 35 - Design Patterns
Session 35 - Design PatternsSession 35 - Design Patterns
Session 35 - Design Patterns
PawanMM
 
Hibernate ppt
Hibernate pptHibernate ppt
Hibernate ppt
Aneega
 
Struts course material
Struts course materialStruts course material
Struts course material
Vibrant Technologies & Computers
 
Java colombo-deep-dive-into-jax-rs
Java colombo-deep-dive-into-jax-rsJava colombo-deep-dive-into-jax-rs
Java colombo-deep-dive-into-jax-rs
Sagara Gunathunga
 
Mvc4
Mvc4Mvc4
Hibernate 3
Hibernate 3Hibernate 3
Hibernate 3
Rajiv Gupta
 
Java database connectivity
Java database connectivityJava database connectivity
Java database connectivity
Vaishali Modi
 
Java spring framework
Java spring frameworkJava spring framework
Java spring framework
Rajiv Gupta
 
Spring mvc 2.0
Spring mvc 2.0Spring mvc 2.0
Spring mvc 2.0
Rudra Garnaik, PMI-ACP®
 
JavaEE and RESTful development - WSO2 Colombo Meetup
JavaEE and RESTful development - WSO2 Colombo Meetup JavaEE and RESTful development - WSO2 Colombo Meetup
JavaEE and RESTful development - WSO2 Colombo Meetup
Sagara Gunathunga
 
Session 31 - Session Management, Best Practices, Design Patterns in Web Apps
Session 31 - Session Management, Best Practices, Design Patterns in Web AppsSession 31 - Session Management, Best Practices, Design Patterns in Web Apps
Session 31 - Session Management, Best Practices, Design Patterns in Web Apps
PawanMM
 
Connecting to external_application
Connecting to external_applicationConnecting to external_application
Connecting to external_application
Rajarajan Sadhasivam
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
Pravin Pundge
 
Java Web Programming [1/9] : Introduction to Web Application
Java Web Programming [1/9] : Introduction to Web ApplicationJava Web Programming [1/9] : Introduction to Web Application
Java Web Programming [1/9] : Introduction to Web Application
IMC Institute
 

What's hot (20)

Dataweave
DataweaveDataweave
Dataweave
 
MVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVCMVC Pattern. Flex implementation of MVC
MVC Pattern. Flex implementation of MVC
 
Frameworks Galore: A Pragmatic Review
Frameworks Galore: A Pragmatic ReviewFrameworks Galore: A Pragmatic Review
Frameworks Galore: A Pragmatic Review
 
Session 36 - JSP - Part 1
Session 36 - JSP - Part 1Session 36 - JSP - Part 1
Session 36 - JSP - Part 1
 
Session 35 - Design Patterns
Session 35 - Design PatternsSession 35 - Design Patterns
Session 35 - Design Patterns
 
Hibernate ppt
Hibernate pptHibernate ppt
Hibernate ppt
 
Struts course material
Struts course materialStruts course material
Struts course material
 
Java colombo-deep-dive-into-jax-rs
Java colombo-deep-dive-into-jax-rsJava colombo-deep-dive-into-jax-rs
Java colombo-deep-dive-into-jax-rs
 
Mvc4
Mvc4Mvc4
Mvc4
 
Hibernate 3
Hibernate 3Hibernate 3
Hibernate 3
 
Java database connectivity
Java database connectivityJava database connectivity
Java database connectivity
 
Java spring framework
Java spring frameworkJava spring framework
Java spring framework
 
Spring mvc 2.0
Spring mvc 2.0Spring mvc 2.0
Spring mvc 2.0
 
JavaEE and RESTful development - WSO2 Colombo Meetup
JavaEE and RESTful development - WSO2 Colombo Meetup JavaEE and RESTful development - WSO2 Colombo Meetup
JavaEE and RESTful development - WSO2 Colombo Meetup
 
Session 31 - Session Management, Best Practices, Design Patterns in Web Apps
Session 31 - Session Management, Best Practices, Design Patterns in Web AppsSession 31 - Session Management, Best Practices, Design Patterns in Web Apps
Session 31 - Session Management, Best Practices, Design Patterns in Web Apps
 
Connecting to external_application
Connecting to external_applicationConnecting to external_application
Connecting to external_application
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
 
Java Web Programming [1/9] : Introduction to Web Application
Java Web Programming [1/9] : Introduction to Web ApplicationJava Web Programming [1/9] : Introduction to Web Application
Java Web Programming [1/9] : Introduction to Web Application
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
 
MVC
MVCMVC
MVC
 

Viewers also liked

[2015/2016] Require JS and Handlebars JS
[2015/2016] Require JS and Handlebars JS[2015/2016] Require JS and Handlebars JS
[2015/2016] Require JS and Handlebars JS
Ivano Malavolta
 
[2015/2016] Apache Cordova APIs
[2015/2016] Apache Cordova APIs[2015/2016] Apache Cordova APIs
[2015/2016] Apache Cordova APIs
Ivano Malavolta
 
[2015/2016] Apache Cordova
[2015/2016] Apache Cordova[2015/2016] Apache Cordova
[2015/2016] Apache Cordova
Ivano Malavolta
 
[2015/2016] Mobile thinking
[2015/2016] Mobile thinking[2015/2016] Mobile thinking
[2015/2016] Mobile thinking
Ivano Malavolta
 
[2015/2016] Backbone JS
[2015/2016] Backbone JS[2015/2016] Backbone JS
[2015/2016] Backbone JS
Ivano Malavolta
 
[2015/2016] User-centred design
[2015/2016] User-centred design[2015/2016] User-centred design
[2015/2016] User-centred design
Ivano Malavolta
 
[2015/2016] Geolocation and mapping
[2015/2016] Geolocation and mapping[2015/2016] Geolocation and mapping
[2015/2016] Geolocation and mapping
Ivano Malavolta
 
[2015/2016] JavaScript
[2015/2016] JavaScript[2015/2016] JavaScript
[2015/2016] JavaScript
Ivano Malavolta
 
The road ahead for architectural languages [ACVI 2016]
The road ahead for architectural languages [ACVI 2016]The road ahead for architectural languages [ACVI 2016]
The road ahead for architectural languages [ACVI 2016]
Ivano Malavolta
 
[2015/2016] Local data storage for web-based mobile apps
[2015/2016] Local data storage for web-based mobile apps[2015/2016] Local data storage for web-based mobile apps
[2015/2016] Local data storage for web-based mobile apps
Ivano Malavolta
 
[2015/2016] Modern development paradigms
[2015/2016] Modern development paradigms[2015/2016] Modern development paradigms
[2015/2016] Modern development paradigms
Ivano Malavolta
 
[2015/2016] AADL (Architecture Analysis and Design Language)
[2015/2016] AADL (Architecture Analysis and Design Language)[2015/2016] AADL (Architecture Analysis and Design Language)
[2015/2016] AADL (Architecture Analysis and Design Language)
Ivano Malavolta
 
[2015/2016] Introduction to software architecture
[2015/2016] Introduction to software architecture[2015/2016] Introduction to software architecture
[2015/2016] Introduction to software architecture
Ivano Malavolta
 
[2015/2016] HTML5 and CSS3 Refresher
[2015/2016] HTML5 and CSS3 Refresher[2015/2016] HTML5 and CSS3 Refresher
[2015/2016] HTML5 and CSS3 Refresher
Ivano Malavolta
 
Web-based Hybrid Mobile Apps: State of the Practice and Research opportunitie...
Web-based Hybrid Mobile Apps: State of the Practice and Research opportunitie...Web-based Hybrid Mobile Apps: State of the Practice and Research opportunitie...
Web-based Hybrid Mobile Apps: State of the Practice and Research opportunitie...
Ivano Malavolta
 
Leveraging Web Analytics for Automatically Generating Mobile Navigation Model...
Leveraging Web Analytics for Automatically Generating Mobile Navigation Model...Leveraging Web Analytics for Automatically Generating Mobile Navigation Model...
Leveraging Web Analytics for Automatically Generating Mobile Navigation Model...
Ivano Malavolta
 
[2015/2016] User experience design of mobil apps
[2015/2016] User experience design of mobil apps[2015/2016] User experience design of mobil apps
[2015/2016] User experience design of mobil apps
Ivano Malavolta
 
Design patterns for mobile apps
Design patterns for mobile appsDesign patterns for mobile apps
Design patterns for mobile apps
Ivano Malavolta
 
Mission planning of autonomous quadrotors
Mission planning of autonomous quadrotorsMission planning of autonomous quadrotors
Mission planning of autonomous quadrotors
Ivano Malavolta
 
Beyond Native Apps: Web Technologies to the Rescue! [SPLASH 2016 - Mobile! k...
Beyond Native Apps:  Web Technologies to the Rescue! [SPLASH 2016 - Mobile! k...Beyond Native Apps:  Web Technologies to the Rescue! [SPLASH 2016 - Mobile! k...
Beyond Native Apps: Web Technologies to the Rescue! [SPLASH 2016 - Mobile! k...
Ivano Malavolta
 

Viewers also liked (20)

[2015/2016] Require JS and Handlebars JS
[2015/2016] Require JS and Handlebars JS[2015/2016] Require JS and Handlebars JS
[2015/2016] Require JS and Handlebars JS
 
[2015/2016] Apache Cordova APIs
[2015/2016] Apache Cordova APIs[2015/2016] Apache Cordova APIs
[2015/2016] Apache Cordova APIs
 
[2015/2016] Apache Cordova
[2015/2016] Apache Cordova[2015/2016] Apache Cordova
[2015/2016] Apache Cordova
 
[2015/2016] Mobile thinking
[2015/2016] Mobile thinking[2015/2016] Mobile thinking
[2015/2016] Mobile thinking
 
[2015/2016] Backbone JS
[2015/2016] Backbone JS[2015/2016] Backbone JS
[2015/2016] Backbone JS
 
[2015/2016] User-centred design
[2015/2016] User-centred design[2015/2016] User-centred design
[2015/2016] User-centred design
 
[2015/2016] Geolocation and mapping
[2015/2016] Geolocation and mapping[2015/2016] Geolocation and mapping
[2015/2016] Geolocation and mapping
 
[2015/2016] JavaScript
[2015/2016] JavaScript[2015/2016] JavaScript
[2015/2016] JavaScript
 
The road ahead for architectural languages [ACVI 2016]
The road ahead for architectural languages [ACVI 2016]The road ahead for architectural languages [ACVI 2016]
The road ahead for architectural languages [ACVI 2016]
 
[2015/2016] Local data storage for web-based mobile apps
[2015/2016] Local data storage for web-based mobile apps[2015/2016] Local data storage for web-based mobile apps
[2015/2016] Local data storage for web-based mobile apps
 
[2015/2016] Modern development paradigms
[2015/2016] Modern development paradigms[2015/2016] Modern development paradigms
[2015/2016] Modern development paradigms
 
[2015/2016] AADL (Architecture Analysis and Design Language)
[2015/2016] AADL (Architecture Analysis and Design Language)[2015/2016] AADL (Architecture Analysis and Design Language)
[2015/2016] AADL (Architecture Analysis and Design Language)
 
[2015/2016] Introduction to software architecture
[2015/2016] Introduction to software architecture[2015/2016] Introduction to software architecture
[2015/2016] Introduction to software architecture
 
[2015/2016] HTML5 and CSS3 Refresher
[2015/2016] HTML5 and CSS3 Refresher[2015/2016] HTML5 and CSS3 Refresher
[2015/2016] HTML5 and CSS3 Refresher
 
Web-based Hybrid Mobile Apps: State of the Practice and Research opportunitie...
Web-based Hybrid Mobile Apps: State of the Practice and Research opportunitie...Web-based Hybrid Mobile Apps: State of the Practice and Research opportunitie...
Web-based Hybrid Mobile Apps: State of the Practice and Research opportunitie...
 
Leveraging Web Analytics for Automatically Generating Mobile Navigation Model...
Leveraging Web Analytics for Automatically Generating Mobile Navigation Model...Leveraging Web Analytics for Automatically Generating Mobile Navigation Model...
Leveraging Web Analytics for Automatically Generating Mobile Navigation Model...
 
[2015/2016] User experience design of mobil apps
[2015/2016] User experience design of mobil apps[2015/2016] User experience design of mobil apps
[2015/2016] User experience design of mobil apps
 
Design patterns for mobile apps
Design patterns for mobile appsDesign patterns for mobile apps
Design patterns for mobile apps
 
Mission planning of autonomous quadrotors
Mission planning of autonomous quadrotorsMission planning of autonomous quadrotors
Mission planning of autonomous quadrotors
 
Beyond Native Apps: Web Technologies to the Rescue! [SPLASH 2016 - Mobile! k...
Beyond Native Apps:  Web Technologies to the Rescue! [SPLASH 2016 - Mobile! k...Beyond Native Apps:  Web Technologies to the Rescue! [SPLASH 2016 - Mobile! k...
Beyond Native Apps: Web Technologies to the Rescue! [SPLASH 2016 - Mobile! k...
 

Similar to [2015/2016] The REST architectural style

Rest
Rest Rest
REST Basics
REST BasicsREST Basics
REST Basics
Ivano Malavolta
 
Restful Fundamentals
Restful FundamentalsRestful Fundamentals
Restful Fundamentals
Suresh Madhra
 
Restful Fundamentals
Restful FundamentalsRestful Fundamentals
Restful Fundamentals
Suresh Madhra
 
ROA.ppt
ROA.pptROA.ppt
ROA.ppt
KGSCSEPSGCT
 
RESTFul WebApp Concept
RESTFul WebApp ConceptRESTFul WebApp Concept
RESTFul WebApp ConceptDian Aditya
 
RESTFul WebApp Concept
RESTFul WebApp ConceptRESTFul WebApp Concept
RESTFul WebApp ConceptDian Aditya
 
Network Device Database Management with REST using Jersey
Network Device Database Management with REST using JerseyNetwork Device Database Management with REST using Jersey
Network Device Database Management with REST using Jersey
Payal Jain
 
Rest and beyond
Rest and beyondRest and beyond
Rest and beyond
Ming Yuan
 
Rest introduction
Rest introductionRest introduction
Rest introduction
William Martinez Pomares
 
REST and RESTful Services
REST and RESTful ServicesREST and RESTful Services
REST and RESTful Services
Damian T. Gordon
 
REST Introduction.ppt
REST Introduction.pptREST Introduction.ppt
REST Introduction.ppt
KGSCSEPSGCT
 
Salesforce REST API
Salesforce  REST API Salesforce  REST API
Salesforce REST API
Bohdan Dovhań
 
JAX-RS. Developing RESTful APIs with Java
JAX-RS. Developing RESTful APIs with JavaJAX-RS. Developing RESTful APIs with Java
JAX-RS. Developing RESTful APIs with Java
Jerry Kurian
 
Rest Webservice
Rest WebserviceRest Webservice
Rest Webservice
Viyaan Jhiingade
 
The Rest Architectural Style
The Rest Architectural StyleThe Rest Architectural Style
The Rest Architectural Style
Robert Wilson
 
Creating Restful Web Services with restish
Creating Restful Web Services with restishCreating Restful Web Services with restish
Creating Restful Web Services with restish
Grig Gheorghiu
 
Introduction To REST
Introduction To RESTIntroduction To REST
Introduction To REST
rainynovember12
 

Similar to [2015/2016] The REST architectural style (20)

Rest
Rest Rest
Rest
 
REST Basics
REST BasicsREST Basics
REST Basics
 
Restful Fundamentals
Restful FundamentalsRestful Fundamentals
Restful Fundamentals
 
Restful Fundamentals
Restful FundamentalsRestful Fundamentals
Restful Fundamentals
 
ROA.ppt
ROA.pptROA.ppt
ROA.ppt
 
RESTFul WebApp Concept
RESTFul WebApp ConceptRESTFul WebApp Concept
RESTFul WebApp Concept
 
RESTFul WebApp Concept
RESTFul WebApp ConceptRESTFul WebApp Concept
RESTFul WebApp Concept
 
ReSTful API Final
ReSTful API FinalReSTful API Final
ReSTful API Final
 
Network Device Database Management with REST using Jersey
Network Device Database Management with REST using JerseyNetwork Device Database Management with REST using Jersey
Network Device Database Management with REST using Jersey
 
Rest and beyond
Rest and beyondRest and beyond
Rest and beyond
 
Rest introduction
Rest introductionRest introduction
Rest introduction
 
REST and RESTful Services
REST and RESTful ServicesREST and RESTful Services
REST and RESTful Services
 
REST Introduction.ppt
REST Introduction.pptREST Introduction.ppt
REST Introduction.ppt
 
Salesforce REST API
Salesforce  REST API Salesforce  REST API
Salesforce REST API
 
JAX-RS. Developing RESTful APIs with Java
JAX-RS. Developing RESTful APIs with JavaJAX-RS. Developing RESTful APIs with Java
JAX-RS. Developing RESTful APIs with Java
 
Rest Webservice
Rest WebserviceRest Webservice
Rest Webservice
 
Rest and Rails
Rest and RailsRest and Rails
Rest and Rails
 
The Rest Architectural Style
The Rest Architectural StyleThe Rest Architectural Style
The Rest Architectural Style
 
Creating Restful Web Services with restish
Creating Restful Web Services with restishCreating Restful Web Services with restish
Creating Restful Web Services with restish
 
Introduction To REST
Introduction To RESTIntroduction To REST
Introduction To REST
 

More from Ivano Malavolta

Conducting Experiments on the Software Architecture of Robotic Systems (QRARS...
Conducting Experiments on the Software Architecture of Robotic Systems (QRARS...Conducting Experiments on the Software Architecture of Robotic Systems (QRARS...
Conducting Experiments on the Software Architecture of Robotic Systems (QRARS...
Ivano Malavolta
 
The H2020 experience
The H2020 experienceThe H2020 experience
The H2020 experience
Ivano Malavolta
 
The Green Lab - Research cocktail @Vrije Universiteit Amsterdam (October 2020)
The Green Lab - Research cocktail  @Vrije Universiteit Amsterdam (October 2020)The Green Lab - Research cocktail  @Vrije Universiteit Amsterdam (October 2020)
The Green Lab - Research cocktail @Vrije Universiteit Amsterdam (October 2020)
Ivano Malavolta
 
Software sustainability and Green IT
Software sustainability and Green ITSoftware sustainability and Green IT
Software sustainability and Green IT
Ivano Malavolta
 
Navigation-aware and Personalized Prefetching of Network Requests in Android ...
Navigation-aware and Personalized Prefetching of Network Requests in Android ...Navigation-aware and Personalized Prefetching of Network Requests in Android ...
Navigation-aware and Personalized Prefetching of Network Requests in Android ...
Ivano Malavolta
 
How Maintainability Issues of Android Apps Evolve [ICSME 2018]
How Maintainability Issues of Android Apps Evolve [ICSME 2018]How Maintainability Issues of Android Apps Evolve [ICSME 2018]
How Maintainability Issues of Android Apps Evolve [ICSME 2018]
Ivano Malavolta
 
Collaborative Model-Driven Software Engineering: a Classification Framework a...
Collaborative Model-Driven Software Engineering: a Classification Framework a...Collaborative Model-Driven Software Engineering: a Classification Framework a...
Collaborative Model-Driven Software Engineering: a Classification Framework a...
Ivano Malavolta
 
Experimenting on Mobile Apps Quality - a tale about Energy, Performance, and ...
Experimenting on Mobile Apps Quality - a tale about Energy, Performance, and ...Experimenting on Mobile Apps Quality - a tale about Energy, Performance, and ...
Experimenting on Mobile Apps Quality - a tale about Energy, Performance, and ...
Ivano Malavolta
 
Modeling objects interaction via UML sequence diagrams [Software Design] [Com...
Modeling objects interaction via UML sequence diagrams [Software Design] [Com...Modeling objects interaction via UML sequence diagrams [Software Design] [Com...
Modeling objects interaction via UML sequence diagrams [Software Design] [Com...
Ivano Malavolta
 
Modeling behaviour via UML state machines [Software Design] [Computer Science...
Modeling behaviour via UML state machines [Software Design] [Computer Science...Modeling behaviour via UML state machines [Software Design] [Computer Science...
Modeling behaviour via UML state machines [Software Design] [Computer Science...
Ivano Malavolta
 
Object-oriented design patterns in UML [Software Design] [Computer Science] [...
Object-oriented design patterns in UML [Software Design] [Computer Science] [...Object-oriented design patterns in UML [Software Design] [Computer Science] [...
Object-oriented design patterns in UML [Software Design] [Computer Science] [...
Ivano Malavolta
 
Structure modeling with UML [Software Design] [Computer Science] [Vrije Unive...
Structure modeling with UML [Software Design] [Computer Science] [Vrije Unive...Structure modeling with UML [Software Design] [Computer Science] [Vrije Unive...
Structure modeling with UML [Software Design] [Computer Science] [Vrije Unive...
Ivano Malavolta
 
Requirements engineering with UML [Software Design] [Computer Science] [Vrije...
Requirements engineering with UML [Software Design] [Computer Science] [Vrije...Requirements engineering with UML [Software Design] [Computer Science] [Vrije...
Requirements engineering with UML [Software Design] [Computer Science] [Vrije...
Ivano Malavolta
 
Modeling and abstraction, software development process [Software Design] [Com...
Modeling and abstraction, software development process [Software Design] [Com...Modeling and abstraction, software development process [Software Design] [Com...
Modeling and abstraction, software development process [Software Design] [Com...
Ivano Malavolta
 
[2017/2018] Agile development
[2017/2018] Agile development[2017/2018] Agile development
[2017/2018] Agile development
Ivano Malavolta
 
Reconstructing microservice-based architectures
Reconstructing microservice-based architecturesReconstructing microservice-based architectures
Reconstructing microservice-based architectures
Ivano Malavolta
 
[2017/2018] AADL - Architecture Analysis and Design Language
[2017/2018] AADL - Architecture Analysis and Design Language[2017/2018] AADL - Architecture Analysis and Design Language
[2017/2018] AADL - Architecture Analysis and Design Language
Ivano Malavolta
 
[2017/2018] Architectural languages
[2017/2018] Architectural languages[2017/2018] Architectural languages
[2017/2018] Architectural languages
Ivano Malavolta
 
[2017/2018] Introduction to Software Architecture
[2017/2018] Introduction to Software Architecture[2017/2018] Introduction to Software Architecture
[2017/2018] Introduction to Software Architecture
Ivano Malavolta
 
[2017/2018] RESEARCH in software engineering
[2017/2018] RESEARCH in software engineering[2017/2018] RESEARCH in software engineering
[2017/2018] RESEARCH in software engineering
Ivano Malavolta
 

More from Ivano Malavolta (20)

Conducting Experiments on the Software Architecture of Robotic Systems (QRARS...
Conducting Experiments on the Software Architecture of Robotic Systems (QRARS...Conducting Experiments on the Software Architecture of Robotic Systems (QRARS...
Conducting Experiments on the Software Architecture of Robotic Systems (QRARS...
 
The H2020 experience
The H2020 experienceThe H2020 experience
The H2020 experience
 
The Green Lab - Research cocktail @Vrije Universiteit Amsterdam (October 2020)
The Green Lab - Research cocktail  @Vrije Universiteit Amsterdam (October 2020)The Green Lab - Research cocktail  @Vrije Universiteit Amsterdam (October 2020)
The Green Lab - Research cocktail @Vrije Universiteit Amsterdam (October 2020)
 
Software sustainability and Green IT
Software sustainability and Green ITSoftware sustainability and Green IT
Software sustainability and Green IT
 
Navigation-aware and Personalized Prefetching of Network Requests in Android ...
Navigation-aware and Personalized Prefetching of Network Requests in Android ...Navigation-aware and Personalized Prefetching of Network Requests in Android ...
Navigation-aware and Personalized Prefetching of Network Requests in Android ...
 
How Maintainability Issues of Android Apps Evolve [ICSME 2018]
How Maintainability Issues of Android Apps Evolve [ICSME 2018]How Maintainability Issues of Android Apps Evolve [ICSME 2018]
How Maintainability Issues of Android Apps Evolve [ICSME 2018]
 
Collaborative Model-Driven Software Engineering: a Classification Framework a...
Collaborative Model-Driven Software Engineering: a Classification Framework a...Collaborative Model-Driven Software Engineering: a Classification Framework a...
Collaborative Model-Driven Software Engineering: a Classification Framework a...
 
Experimenting on Mobile Apps Quality - a tale about Energy, Performance, and ...
Experimenting on Mobile Apps Quality - a tale about Energy, Performance, and ...Experimenting on Mobile Apps Quality - a tale about Energy, Performance, and ...
Experimenting on Mobile Apps Quality - a tale about Energy, Performance, and ...
 
Modeling objects interaction via UML sequence diagrams [Software Design] [Com...
Modeling objects interaction via UML sequence diagrams [Software Design] [Com...Modeling objects interaction via UML sequence diagrams [Software Design] [Com...
Modeling objects interaction via UML sequence diagrams [Software Design] [Com...
 
Modeling behaviour via UML state machines [Software Design] [Computer Science...
Modeling behaviour via UML state machines [Software Design] [Computer Science...Modeling behaviour via UML state machines [Software Design] [Computer Science...
Modeling behaviour via UML state machines [Software Design] [Computer Science...
 
Object-oriented design patterns in UML [Software Design] [Computer Science] [...
Object-oriented design patterns in UML [Software Design] [Computer Science] [...Object-oriented design patterns in UML [Software Design] [Computer Science] [...
Object-oriented design patterns in UML [Software Design] [Computer Science] [...
 
Structure modeling with UML [Software Design] [Computer Science] [Vrije Unive...
Structure modeling with UML [Software Design] [Computer Science] [Vrije Unive...Structure modeling with UML [Software Design] [Computer Science] [Vrije Unive...
Structure modeling with UML [Software Design] [Computer Science] [Vrije Unive...
 
Requirements engineering with UML [Software Design] [Computer Science] [Vrije...
Requirements engineering with UML [Software Design] [Computer Science] [Vrije...Requirements engineering with UML [Software Design] [Computer Science] [Vrije...
Requirements engineering with UML [Software Design] [Computer Science] [Vrije...
 
Modeling and abstraction, software development process [Software Design] [Com...
Modeling and abstraction, software development process [Software Design] [Com...Modeling and abstraction, software development process [Software Design] [Com...
Modeling and abstraction, software development process [Software Design] [Com...
 
[2017/2018] Agile development
[2017/2018] Agile development[2017/2018] Agile development
[2017/2018] Agile development
 
Reconstructing microservice-based architectures
Reconstructing microservice-based architecturesReconstructing microservice-based architectures
Reconstructing microservice-based architectures
 
[2017/2018] AADL - Architecture Analysis and Design Language
[2017/2018] AADL - Architecture Analysis and Design Language[2017/2018] AADL - Architecture Analysis and Design Language
[2017/2018] AADL - Architecture Analysis and Design Language
 
[2017/2018] Architectural languages
[2017/2018] Architectural languages[2017/2018] Architectural languages
[2017/2018] Architectural languages
 
[2017/2018] Introduction to Software Architecture
[2017/2018] Introduction to Software Architecture[2017/2018] Introduction to Software Architecture
[2017/2018] Introduction to Software Architecture
 
[2017/2018] RESEARCH in software engineering
[2017/2018] RESEARCH in software engineering[2017/2018] RESEARCH in software engineering
[2017/2018] RESEARCH in software engineering
 

Recently uploaded

UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 

Recently uploaded (20)

UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 

[2015/2016] The REST architectural style

  • 1. Gran Sasso Science Institute Ivano Malavolta REST
  • 2. Roadmap The REST Architectural Style Resources Representations Actions
  • 3. REST It stands for REpresentational State Transfer Proposed by Roy Fieldings in his PhD dissertation in 2000 REST rules the architectureof the World Wide Web (HTTP)
  • 5. REST Architectural Style REST is neither a technology nor a framework REST is an ArchitecturalStyle à a set of principles + constraints Those constraints help us in developing applicationsthatare “easy” to maintainand extend
  • 6. REST Main Constraints A RESTful system • is client-server • is stateless – there should be no need for the service to keep users’ sessions – each request should be independent of others • has to support a caching system • has to be uniformlyaccessible – each resource must have a unique address and a validpoint of access
  • 7. The (static) Web as a RESTful system 1. you type a URL into your browser to reach a specific HTML page 2. the browser gets and displays the elements of the HTML page à the browser is getting a representationof the currentstate of that resource
  • 8. REST Main Actors These are the abstractionsthatmake a RESTful system: • Resources • Representations • Actions
  • 9. Roadmap The REST Architectural Style Resources Representations Actions
  • 10. Resources A resource is “everything”the service can provide Statesand functions of a remote applicationarealso considered as resources Example of resources: • titleof a movie from IMDb • a Flash movie from YouTube • images from Flickr • order info from eBay • etc.
  • 11. Resources In general, a RESTful resource is anythingthat is addressable over the Web Addressable = anythingthatcan be accessed and transferred between client and server à a resource must have a unique address overthe Web Under HTTP these are URIs
  • 12. URIs UniformResource Identifier in a RESTful web service is a hyperlinkto a resource It is the only means forclients and servers to exchange representationsof resources ex. .../orderinfo?id=123
  • 13. URIs The URI is not meant to change over time à it is the only means to identify a specific resource URIs are also used to negotiaterepresentations of a given resource In the URI you give certainparameters thatdefine which informationyou wantthe server to returnto you (just like giving GET variablesto a page) The server will respond with a resource representation containingthe information you’veasked
  • 14. Roadmap The REST Architectural Style Resources Representations Actions
  • 15. Representations The representationof resources is whatis sent back and forth between clients and servers So, we neversend or receive resources, only theirrepresentations
  • 16. URL UniformResource Locator A URL is a specializationof URI that defines the networklocation of a specific resource Unlike a URI, the URL defines how the resource can be obtained es. http://some.domain.com/orderinfo?id=123
  • 17. URL URIs and URLs are also used to link resources together ex.
  • 18. Representations The formatof the representationis determined by the content- type The interactionof the representationon the resource is determined by the action (GET, SET,etc.)
  • 19. Content-types Since we are using HTTP to communicate,we can transferany kind of informationthatcan be passed between clients and servers ex. text files, PDF documents, images, videos, etc. In anycase, the data is streamed over TCP/IPand the browser knows how to interpretthe binary streams because of the HTTP protocolresponse header Content-Type
  • 20. Representation Formats Different clients are able to consume differentrepresentations of the same resource A representationcan take various forms, such as: • image • a text file • an XML stream • a JSON stream but its resource has to be availablethroughthe same URI
  • 21. Representation Formats For human-generated requests through a web browser, a representationis typicallyinthe form of an HTML page For automatedrequests from other web services, readabilityis not as importantand a more efficient representationcan be used such as XML or JSON
  • 22. Roadmap The REST Architectural Style Resources Representations Actions
  • 23. Actions Actions are used to operate on resources For example, they can be usedfor – getting info about a movie – addinga photo to Flickr – deleting a file from a folder The datatransmitted to and from the resource is a representation of it
  • 24. HTTP-based Actions Under HTTP, actions are standardHTTP request: GET POST PUT DELETE They make up the uniform interfaceused for client/serverdata transfers
  • 25. HTTP-based Actions RESTful web services can also execute logic at the server level, but remember thatevery result must be a resource representation
  • 26. HTTP as Uniform Interface In RESTful systems we focus on resource names, whereas in traditionalweb systems we focussed on the actions to be performed on resources à In RESTful systems we have fourspecific actionsthat we can take upon resources — Create,Retrieve, Update,and Delete (CRUD) In traditionalweb applications,we could have countless actions with no naming or implementationstandards
  • 27. The Classroom Example Artificialexample of a web service handling students in some classroom Locationof the service = http://restfuljava.com/ Resources are represented as XML streams
  • 28. The Classroom Example: URIs Student (identified by name): http://restfuljava.com/students/{name} List of students: http://restfuljava.com/students
  • 29. The Classroom Example: Representations Student: <student> <name>Jane</name> <age>10</age> <link>/students/Jane</link> </student>
  • 30. The Classroom Example: Representations Students List: <students> <student> <name>Jane</name> <age>10</age> <link>/students/Jane</link> </student> <student> <name>John</name> <age>11</age> <link>/students/John</link> </student> </students>
  • 31. GET The method GET is used to RETRIEVE resources It cannot have side-effects àit can be done repeatedly withoutchanging the state of the resource It can also returnonly parts of the resource à it can act as both a read operation and a query operation
  • 33. POST The method POST is used to CREATE resources Usually,the resource identity/URLis not known at creationtime à The URL of the newly createdresource is usually created automaticallybythe server
  • 35. PUT The method PUT is used to UPDATE resources Recurrent PUT workflow: 1. we firstGET the representationof the resource we need to update 2. in the client we update the resource with the new value(s) 3. we update the resource using a PUT request togetherwith the representationas its payload
  • 36. PUT Example The initial GET is omitted here
  • 37. DELETE The method DELETE is used to DELETE resources SimilarlytoPUT, also in this case we need the URI of the resource being deleted
  • 39. A note on PUT and DELETE PUT and DELETE apply to the entire resource à when doinga PUT or DELETE operation, the entire resource is replaced/deleted The PUT and DELETE operations are atomic à if two PUT/DELETE operations occur simultaneously, one of them will win and determine the final state of the resource
  • 40. HTTP Status Codes RESTful services use these codes to return informationaboutthe response of the requests 1xx informationalmessage 2xx success message 3xx redirectsthe client to another URL 4xx client-side error 5xx server-side error
  • 41. LAB Extend the app of the previous labs so that products and producers are real data coming from the Loveitaly VM Another example of Rest API: http://www.nestoria.co.uk/help/api http://api.nestoria.it/api?place_name=laquila&encoding=json&pretty=1&listing_type=buy&country=it&action=search_listings
  • 43. Contact Ivano Malavolta | Gran Sasso Science Institute iivanoo ivano.malavolta@gssi.infn.it www.ivanomalavolta.com