Representational State Transfer - RESTful Web Services

RESTful Web Services

A RESTful web service (also called a RESTful web API) is a web service implemented using HTTP and the principles of REST. It is a collection of resources, with four defined aspects:

  • the base URI for the web service, such as http://example.com/resources/
  • the Internet media type of the data supported by the web service. This is often XML but can be any other valid Internet media type provided that it is a valid hypertext standard.
  • the set of operations supported by the web service using HTTP methods (e.g., GET, PUT, POST, or DELETE).
  • The API must be hypertext driven.

The following table shows how the HTTP methods are typically used to implement a web service.

RESTful Web Service HTTP methods
Resource GET PUT POST DELETE
Collection URI, such as http://example.com/resources/ 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, such as http://example.com/resources/item17 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. Not generally used. 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.

The PUT and DELETE methods are idempotent methods. The GET method is a safe method (or nullipotent), meaning that calling it produces no side-effects.

Unlike SOAP-based web services, there is no "official" standard for RESTful web services. This is because REST is an architectural style, unlike SOAP, which is a protocol. Even though REST is not a standard, a RESTful implementation such as the Web can use standards like HTTP, URI, XML, etc.

Read more about this topic:  Representational State Transfer

Famous quotes containing the words web and/or services:

    Thou blind man’s mark, thou fool’s self-chosen snare,
    Fond Fancy’s scum and dregs of scattered thought,
    Band of all evils, cradle of causeless care,
    Thou web of will whose end is never wrought;
    Desire! desire, I have too dearly bought
    With price of mangled mind thy worthless ware;
    Sir Philip Sidney (1554–1586)

    It seems I impregnated Marge
    So I do rather feel, by and large,
    Some cash should be tendered
    For services rendered,
    But I can’t quite decide what to charge.
    Anonymous.