Marc Hadley on WADL: a RESTful API Description Language


Marc Hadley (from Sun Microsystems) is giving a talk called "Describing Web Applications - WADLing with Java." WADL is a RESTful description language for Web APIs. WADL comprises resource, method, request, and response descriptions.

Marc gives an example using the Yahoo News Search API. Resources are specified relative to a base URI and can describe parameters that are common to all methods. Methods are the standard HTTP methods and can specify a request and response set for that method. Responses have representations that describe the type of the response. The language can also describe faults as responses.

There are tools for turning WADL into Java. wadl2java can be run from the command line or from Ant. He originally used XSLT to generate code, but that didn't work very well. Now he uses the JAXB CodeModel.

He shows some examples of using the resulting Java code. Pretty clean.

The Sun Web Developer Pack is a collection of tools for "Ajax, Scripting and REST-based services development supported by a NetBeans plugin."

Thomas Steiner has created REST Describe, a tool for creating WADL from an API. REST Compile, also from Thomas Steiner, will, I think, generate code besides Java, although figuring out what is pretty hard from the site.

Personally, I believe that the lack of a description language has held back the use of RESTful APIs. WADL is a good step in the direction of rectifying that.