GPW2014 - REST workshop

On the first day of the German Perl Workshop I was attending a workshop held by Lars Dɪᴇᴄᴋᴏᴡ 迪拉斯 (daxim) from Vienna.PM. Based on code taken from a real world application he showed us how to implement a modern REST Architecture that goes far beyond the otherwise seen and mostly unusable demo programs.

The Infrastructure Layer of his architecture is a DBIx::Class driven Schema model containing all entities which are later made accessable by the REST API.

The Application Layer is based on Catalyst and uses some very clever tricks for dispatching incoming requests to the right action methods that care about the various use cases (think: HTTP Verbs).

He used a couple of supporting modules like Data::HAL for generating standards-complient HAL easily. HAL offers a set of conventions to provide hyperlinks in JSON. Furthermore, syntactical and semantical validation is done using a subclass of JSON::Tiny::Subclassable and JE evaluating a prepared javascript due to the lack of a Perl implementation currently.

Caching is the final ingedient of the game ensuring reasonable performance when used in a real-life environment.

The astonishing part for me was that the pure operations triggered by modifying HTTP verbs are 90 percent error-checking and only 10 percent work. I had guessed a 50:50 ratio before.

I which, we had more time. Daxim, can we start at 7:30 next time?

3 Comments

I'd love to see a video of that, or the slides? Any idea where to look?

thanks! I'd love to see this since I am working on core improvements to catalyst around REST and would be interested to see what prior art is around --john

Leave a comment

About Wolfgang Kinkeldei

user-pic I blog about Perl.