Java Reference
In-Depth Information
and use by others outweighs any difi culty created by a lack of a standard. Making a RESTful
resource for consumption is as simple as providing a URI, and using the HTTP protocol cross‐
language communication is easy. The common language is HTTP, the language of the web, which is
simple and understood by all.
Bandwidth limitation situations prove no problem for REST's lightweight approach and are
especially attractive on mobile devices. It costs little to make a request for a resource from a
RESTful API. Remember that it is just an HTTP request and that the data returned can be in any
appropriate format. The format does not have to be JSON or XML; it can be Atom Syndicate
Format (ATOM) or some custom format. The l exibility afforded by using just a simple URI to
represent a resource allows the client developer to be imaginative. You can use Asynchronous
Javascript and XML (AJAX) to call one or more URIs, perhaps from different REST providers. You
can combine the responses to these calls to provide rich content for the site's visitors.
If your implementation of REST uses the HTTP protocol (which it most probably will), you receive
the bonus feature of free caching. The HTTP protocol incorporates a cache as a core feature that
you can exploit in your application by setting appropriate HTTP header values.
You r application's REST API should be simple and intuitive for other developers to use, and it is your
responsibility as a developer to design an API that i ts the requirement of your application while ensuring
that the API's users can access the resources required for the proper function of their application.
In this chapter we have touched upon the basics of a good RESTful API design. There are many
more considerations that we have not even mentioned, such as security, the use of query strings, and
how to provoke server side tasks.
Luckily REST is ubiquitous, and resources to help you develop a truly RESTful API are plentiful.
Just search the Internet and you will not be at a loss for articles, forums, and topics devoted to the
topic of REST.
1. Search the Internet for public RESTful APIs, and write some simple code that consumes them.
2. Implement the URI for the forum site detailed in the preceding text, and write a front end
client that consumes them.
3. Develop one journey through the site using a fully HATEOAS‐style approach.
Search WWH ::

Custom Search