RESTfulll web services

11
RESTful Web Services Juan Sandoval @juanitodread

Transcript of RESTfulll web services

Page 1: RESTfulll web services

RESTful Web ServicesJuan Sandoval@juanitodread

Page 2: RESTfulll web services

AgendaIntroduction to REST

IntroductionPrinciples

Design RESTful services

Page 3: RESTfulll web services

● Introduction to RESTREST is a set of architectural principles that answer the following questions:

Why is the web so prevalent and ubiquitous?

What makes the web scale?How can I apply the architecture of the Web to my own applications?

Page 4: RESTfulll web services

● PrinciplesREST: REpresentational State Transfer

Addressable resourcesA uniform, constrained interfaceRepresentation-orientedCommunicate statelesslyHypermedia As The Engine Of Application State

(HATEOAS)

Page 5: RESTfulll web services

AddressabilityIs the idea that every object and resource in your system is reachable through a unique identifier.In REST is managed through the use of URIs.Each HTTP request must contain the URI of the object you are requesting information

scheme://host:port/path?query#fragment

Page 6: RESTfulll web services

Constrained InterfaceYou must use the finite set of operations of HTTP. Each method has a specific purpose and meaning.

GetPutDeletePostHeadOptions

Page 7: RESTfulll web services

Representation-OrientedThe representation is the message body of your request or response. An HTTP message body may be in any format the server and client want to exchange.

HTTP content negotiation is a very powerful tool when writing web services.

Page 8: RESTfulll web services

Communicate StatelesslyIs the idea that there is no client session data stored on the server. The server only records and manages state of the resource it exposes. If there needs to be session-specific data, it should be held and maintained by the client and transferred to the server with each request as needed.

Page 9: RESTfulll web services

HATEOASThe idea is use Hypermedia As The Engine Of Application State. Hypermedia is a document-centric approach with the added support for embedding links to other services and information within that document format.

HATEOAS enforces with each request returned from a server it tells you what new interactions you can do next, as well as where to go to transition the state of your applications.

Page 10: RESTfulll web services

Design RESTful ServicesDefine the object model.Define a distributed interface through HTTP.Define a set of URIs that represent the entry points

into our system.Define the data format that we will use to exchange

information between services and clients.Define which HTTP methods are allowed by each

exposed URI and what those methods do.

Page 11: RESTfulll web services

Code of the course: e-commerce-rest-api

Thank you!