REST

Representational State Transfer (REST) is a Web standard architecture that provides a method for communication between a Web service and a client over HTTP.

REST Web service resources are implemented through representations. Representations are the state of the resource transferred between the client and the server. Typically, these representations are sent and received in JSON or XML format.

If, for example, the client representation is to get some records from a database, the server does not send its database, instead it sends some JSON or XML that represents these records.

RESTful Web services are stateless. Each HTTP request–response message between the client and the server must be self-descriptive and include enough information to process the message.

The Web services client application request delivers state via body contents, query parameters, request headers, and the requested URI (the resource name).

The "StockQuote" service mentioned in the Introduction to Web services may receive a request for services, and information is returned in JSON as shown in the following:

Request

GET http://localhost:8090/ws/r/quotes?symbol=MyStockSymbol

Headers:
  { "Accept": "application/json",
    "Content-Type": "application/json"}

Body:
  

Response

According to the HTTP request headers (Accept and Content-type), the response is delivered as JSON.
{
    "stockValue": "999.99"
}