54.4. Get REST Data, Minimal Intro Example

REST?. One interpretation of what the link says is that it is data presenting the resource in a textual way, and that it is independent of what it is meant for. This means that its raw data can be extracted and used in the consumers context.

The article also says that REST implies potential updates of the resource data. In many cases that will not, and should not be possible because the data does not belong to the consumer. In an in house situation, however, it is perfectly feasible.

In order to illustrate some of the essential aspects of REST consumption, we have made a small example. The API in question requires only one parameter, a valid name of a continent. In return it will give you data about all the countries of that continent.

The consumer, the JavaScript of the HTML5 page will then present it in the way it pleases.

Example 54.1. The Page world3rd.html
<xi:include></xi:include>
            

Click here!


Example 54.2. The JavaScript world3rd.js
<xi:include></xi:include>