Upload
fernando-oliveira
View
324
Download
1
Embed Size (px)
Citation preview
RESTFUL WEBSERVICESFernando Oliveira
Web Services
Internet
Web Service
Database
File System
REpresentational State Transfer
RESThttps://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm
"architectural style for distributed hypermedia systems” (Roy Thomas Fielding)
Implementation in accordance with REST
REST Constraints
Client-Server1
Stateless2
Isolated RequestsAll requests must to have all information needed to process the requested operation
Cache3
Uniform Interfaces4
“Any information that can be named can be a resource: a document or image, a temporal service, a collection of other resources, a non-virtual object (e.g. a person), and so on. A resource is a conceptual mapping to a set of entities, not the entity that corresponds to the mapping at any particular point in time.
Roy Fieldinghttps://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm
GET | POST http://www.example.com/customers
GET | PUT | DELETE http://www.example.com/customers/33245
Recursos
➤Removes a Resource
➤Updates an existing Resource
➤Creates a new Resource
➤Retrieves a Resource ➤CacheableGET
POST
PUT
DELETE
HATEOAS HATEOAS - Hipermedia As The Engine Of Application State
GET /items?q=macbook+air {
“results”: [ {
“_links”: [ { “rel”: “self”, “uri”: “/items/123“ }, { “rel”: “bids”, “uri”: “/items/123/bids“ }, { “rel”: “win”, “uri”: “/items/123/bids?q=win“ }
], “name”: “Macbook Air 2010 new”, “price”: “2300” }
] }
Layered System5
Code on Demand (Optional)6
The Optional code on demand constraint allows clients to request and execute code from servers.
This, in turn, allows the server to deploy new features to clients.
EXEMPLOS