A web developer's blog. PHP, MySQL, CakePHP, Zend Framework, Wordpress, Code Igniter, Django, Python, CSS, Javascript, jQuery, Knockout.js, and other web development topics.

Zend Framework: Creating your own RESTful Services

Matthew Weier O’Phinney has a very useful post for the latest release (1.9) of Zend Framework.

As a followup to my previous post, I now turn to RESTful web services. I originally encountered the term when attending php|tropics in 2005, where George Schlossnaggle likened it to simple GET and POST requests. Since then, the architectural style — and developer understanding of the architectural style — has improved a bit, and a more solid definition can be made.
At its heart, REST simply dictates that a given resource have a unique address, and that you interact with that resource using HTTP verbs. The standard verbs utilized are:

GET: retrieve a list of resources, or, if an identifier is present, view a single resource
POST: create a new resource with the data provided in the POST
PUT: update an existing resource as specified by an identifier, using the PUT data
DELETE: delete an existing resource as specified by an identifier

The standard URL structure used is as follows:

“/resource” – GET (list) and POST operations
“/resource/{identifier}” – GET (view), PUT, and DELETE operations

What the REST paradigm provides you is a simple, standard way to structure your CRUD (Create-Read-Update-Delete) applications. Due to the large number of REST clients available, it also means that if you follow the rules, you get a ton of interoperability with those clients.

As of Zend Framework 1.9.0, it’s trivially easy to create RESTful routes for your MVC application, as well as to handle the various REST actions via action controllers.

The full article is here: http://weierophinney.net/matthew/archives/228-Building-RESTful-Services-with-Zend-Framework.html.

I am pretty sure that this post will come in handy for me.

This entry was posted in Uncategorized. Bookmark the permalink.

One Response to Zend Framework: Creating your own RESTful Services

  1. I think all this rest stuff is more hype than reality – i dont really see a need to use PUT and DELETE – specially when half the time dont work correctly.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>