Introduction to RESTful service
REST – Representational State Transfer
"REST, an architectural style for building distributed hypermedia driven applications, involves building Resource-Oriented Architecture (ROA) by defining resources that implement uniform interfaces using standard HTTP verbs (GET, POST, PUT, and DELETE), and that can be located/identified by a Uniform Resource Identifier (URI)."
Any Service which follows this REST architecture style is called as RESTful service. It became very popular because of it behavior, it is similar to the website i.e we can load the server information using web url in the browser. similarly we can also access/modify the server resource using Url in RESTful service
- RESTful service will allow the client (written in different language)to access or modify the resource in the server using URL.
- RESTful service uses the http protocol for its communication and it is stateless
- RESTful service can transfer the data in XML,JSON,RSS,ATOM
SOAP | POX(plain-old XML) | REST |
---|---|---|
|
|
|
This basic REST design principle establishes a one-to-one mapping between create, read, update, and delete (CRUD) operations and HTTP methods. According to this mapping
- 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.
RESTful service can be created by using WebGetAttribute and WebInvokeAttribute attribute. RESTful service has provided separate attribute for GET operation (WebGet) because it want to make use of complete features. Other operations like POST,PUT,DELETE will come under the WebInvoke attribute.