Thursday, 10 March 2011

RESTful Web Services

How the HTTP methods are typically used to implement a web service:
Resource GET PUT POST DELETE
Collection URI List the URIs and perhaps other details of the collection's members. Replace the entire collection with another collection. Create a new entry in the collection. The new entry's URL is assigned automatically and is usually returned by the operation. Delete the entire collection.
Element URI Retrieve a representation of the addressed member of the collection, expressed in an appropriate Internet media type. Replace the addressed member of the collection, or if it doesn't exist, create it. Treat the addressed member as a collection in its own right and create a new entry in it. Delete the addressed member of the collection.


Difference between GET and POST as form submission methods
  • GET: With the HTTP "GET" method, the form data set is appended to the URI specified by the action attribute (with a question-mark ("?") as separator) and this new URI is sent to the processing agent.
  • POST: With the HTTP "POST" method, the form data set is included in the body of the form and sent to the processing agent.
The "GET" method should be used when the form is idempotent (i.e. causes no side-effects). Many database searches have no visible side-effects and make ideal applications for the "GET" method. Note. The "GET" method restricts form data set values to ASCII characters. Only the "POST" method is specified to cover the entire character set.

 Sources: http://en.wikipedia.org/wiki/Representational_State_Transfer#RESTful_web_services
http://www.w3.org/TR/html401/interact/forms.html#h-17.13.1

No comments :

Post a Comment