•A web service based on REST is called a RESTful web service. •REST is not dependent on any protocol, but almost every RESTful service uses HTTP as its underlying protocol.
Resources and Representations•Any information that can be named can be a resource: •a document, an image, a temporal service, a real life thing such as a customer, a collection of other resources, etc.•The state of resource at any particular time (e.g., at the time of the request) is known asresource representation. •A representation consists of data, metadata describing the data andhypermedialinks which can help the clients in transition to next desired state.•A representation should be able to completely represent a resource. •If there is a need to partially represent a resource, then you should think about breaking this resource into child resources.•REST does not impose any restriction on the format of a resource representation.•Could be using JSON, XML or HTML.
REST Architecture Constraints•An application or architecture considered RESTful or REST-style has the following characteristics:•Uniform Interface•Client-Server Separation•Be stateless•Cacheable•Layered
Uniform Interface•A RESTful service uses a directory structure-like URIs to address its resources. •<protocol>://<service-name>/<ResourceType>/<ResourceID>•Another important attribute of a request is VERB which identifies the operation to be performed on the resource.•REST asks developers to use HTTP methods explicitly and in a way that's consistentwith the HTTP protocol. •This basic REST design 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.
Client-Server Separation•The client and the server act independently, each on its own, and the interaction between them is only in the form of client-server request-response interaction.•The server just sits there waiting for requests from the client to come.
Be Stateless•Stateless means the server does not remember anything about the client. •Each individual request contains all the informationthe server needs to perform the request and return a response, regardless of other requests made by the same user before.•No client context shall be stored on the server between requests. The clientis responsible for managing the state of the application.
You've reached the end of your free preview.
Want to read all 23 pages?
Web Services, Representational State Transfer, Hypertext Transfer Protocol