Rest Explained
Eduardo Melgar
Web Services
• Software system designed to support interoperable machine-to-machine interaction over a network • Require an architecturalstyle to make sense of them • Common styles of use are RPC and REST
What are REST Web Services
• Architectural style. • Specifies six constraints:
– Client-Server: portability & scalability –Stateless: atomic, idempotent operations – Cacheable: performance – Layered System: transparency – Uniform Interface: independent evolution – (Code on Demand): executable logic
REST Uniform Interface• Identification of resources
– Individual resources are identified in requests: each unique URL is a representation of some object
• Resources are manipulated through their representations •Multiple representations are accepted or sent
REST Uniform Interface (cont.)
• Self-descriptive and stateless messages
– Each message includes enough information to describe how to process themessage
• Hypermedia as the Engine of Application State
– Everything else related should be discoverable dynamically from a URL through "hypermedia" links.
REST Uniform Interface (cont.)
• RESTdesign principle establishes a one-to-one mapping between create, read, update, and delete (CRUD) operations and HTTP methods
– To create a resource on the server, use POST. – To retrieve a resource,use GET. – To change the state of a resource or to update it, use PUT. – To remove or delete a resource, use DELETE.
REST vs. Non-REST
• Non-REST designs (i.e. SOAP)
– Great for the Data Center(communications are strict and structured) – Significantly higher coordination costs, i.e. SOAP:
• Wrap the body in a SOAP envelope; POST it to an endpoint URI; a response comes back, which you mustunwrap
– State management on server side
REST vs. Non-REST
• Lightweight: Bandwidth, no XML Wrappers • API Flexibility & Simplicity: URI, HTTP API easier than SOAP API • Separates server...
Regístrate para leer el documento completo.