Building a ReST API with Railo

 

Overview

This tutorial does not go into the concepts of ReST and why you would want to use it. I assume you are here because you want to implement it with Railo.

I will start out with a brain dump of the things I have discovered during my development of a ReSTful API. I will then flesh out with examples.

HTML web sites are pretty much a sub set of ReST. Browsers only use two methods: GET and POST. A page is a HTML representation of some information - a Resource. I you have an option to save page as PDF, the representation is APPLICATION/pdf - the mime type. Images, StyleSheets and JavaScript are also example of resource. You will no doubt be familiar with the page not found - 404; is a status code. Other common codes are 200 - OK and 401 - Unauthorized. The HTTP protocol has a lot more to it than this, and ReST makes full use of it.

Check out the features page on Rest introduction in Railo 4 beta

Concepts (to be) covered

  1. URL
  2. Method
  3. Mime Type
  4. Status Code
  5. Hypermedia
  6. CORS
  7. Security

Topics

  1. Getting Started
  2. Building Blocks
  3. Locating the Resource - URL
  4. Doing somthing with the Resource - Method
  5. Communicating with the Resource - Mime Types
  6. Monitoring the Resource - Status Code
  7. Using the ReST API

Please leave comments for anything you would like covered or explained in detail.

Whilst there is no one right way to building a ReSTful API, there seems to plenty of wrong ways. I will simply delete any comments which I feel are non-constuctive, trolling or flame bait.