Chapter 3. RESTful Web Services: The Client Side
Consider a familiar scenario in which a client accesses a RESTful web service:
- The client issues a GET request against a RESTful service. In general, a request to a RESTful service targets a named resource, with a URI as the name.
- If successful, this GET request results in a response document, a representation of the resource targeted in the request. The document is usually in XML or JSON, although other formats might be available. In any case, the response should be MIME-typed.
- The client extracts from the document whatever information is required for the client’s application logic.
Each step in this sample scenario poses a challenge. The GET request must be formatted properly, and the status code of the response should be inspected to determine whether the request succeeded and, if not, why not. The toughest challenge for the client, however, may be extracting required information from the document: the ...