of 22 /22
RESTFUL WEBSERVICES Fernando Oliveira

RESTFul api

Embed Size (px)

Citation preview

Page 1: RESTFul api

RESTFUL WEBSERVICESFernando Oliveira

Page 2: RESTFul api

Web Services

Page 3: RESTFul api

Internet

Web Service

Database

File System

Page 4: RESTFul api

REpresentational State Transfer

RESThttps://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm

"architectural style for distributed hypermedia systems” (Roy Thomas Fielding)

Page 5: RESTFul api

Implementation in accordance with REST

Page 6: RESTFul api

REST Constraints

Page 7: RESTFul api

Client-Server1

Page 8: RESTFul api
Page 9: RESTFul api

Stateless2

Page 10: RESTFul api

Isolated RequestsAll requests must to have all information needed to process the requested operation

Page 11: RESTFul api

Cache3

Page 12: RESTFul api

Uniform Interfaces4

Page 13: RESTFul api

“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

Page 14: RESTFul api

GET | POST http://www.example.com/customers

GET | PUT | DELETE http://www.example.com/customers/33245

Recursos

Page 15: RESTFul api

➤Removes a Resource

➤Updates an existing Resource

➤Creates a new Resource

➤Retrieves a Resource ➤CacheableGET

POST

PUT

DELETE

Page 16: RESTFul api
Page 17: RESTFul api

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” }

] }

Page 18: RESTFul api

Layered System5

Page 19: RESTFul api
Page 20: RESTFul api

Code on Demand (Optional)6

Page 21: RESTFul api

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.

Page 22: RESTFul api

EXEMPLOS