Lots of very exciting things are happening right now for us web standards aficionados. The big news is the buzz around HTML 5 and its growing support in modern web browsers (modern meaning not Internet Explorer). The current state of web standards makes it difficult, but certainly not impossible, to use the web as a true application platform. HTML 5 promises to change this (maybe not fully until 2022 — but we’re patient). Many articles have been written about HTML 5 but there’s one tiny, but very important, feature I’d like to focus on here: support for the HTTP PUT and DELETE methods in forms. First, a little bit about REST…
I’ve talked about REST here before but REST is useful for more than just building web services. REST is an abbreviation for representational state transfer and is an architectural style for building software. The web itself is built using REST so it is a proven and scalable architecture. Unfortunately many web developers ignore REST to their detriment. Conforming to REST principles can help with search engine optimization (SEO) as well as make your web applications more usable (through predictability of actions) and scalable (the web itself has scaled to massive proportions).
Using a RESTful approach, every URL is a representation of a resource (a noun). These resources can then be retrieved and manipulated (have their state changed) using a standard set of verbs. These verbs are actually HTTP methods. There are a whole bunch of verbs/HTTP methods but only worry about four of them (at least for now): GET, POST, PUT, and DELETE. Here is an example of how some nouns and verbs can be used to together, borrowing from the Atom Publishing Protocol (APP):
|GET||/people||GETs a collection of people|
|POST||/people||POSTs a new person to the collection (using data in the POST request)|
|PUT||/people/bradley-holt||PUTs an updated version of bradley-holt (using data in the PUT request)|
For you Zend Framework developers: I just learned today that Zend Framework 1.9 will include a new REST router which will help web developers adhere to RESTful principles. Please use it and also use the new PUT and DELETE methods in HTML 5 forms as browser support catches on.