On Jan 6, 2008 5:30 PM, Luke Crouch <
luke.crouch@...> wrote:
> I don't think I know a *lot* about REST, but I'm in the middle of this right
> now ... trying to build a RESTful API with ZF MVC. As I've explained in
> another thread in the fw-mvc list, I have found the Action Controllers to be
> a bit cumbersome in trying to implement a fully REST design - IMO, one in
> which the URI contains only nouns and identifiers, and the "action" is
> determined by the HTTP request method. e.g.,
>
> GET
http://localhost/module/entity-type/id1> goes to:
> application/modules/<module>/<entity-type>Controller.php::getAction()
>
> more specifically:
>
> GET
http://localhost/users/profile/groovecoder> goes to:
> application/modules/users/ProfileController::getAction()
>
> from my attempts this last week to do this via custom routes, I thought the
> cleanest way to fully support REST in ZF is with a
> Zend_Controller_Router_Rest and/or Zend_Controller_Router_Route_Rest class.
>
> it would also be nice to be able to optionally specify identifiers b/w
> module and controller elements in the url:
>
> GET
http://localhost/users/groovecoder/profile> also goes to:
> application/modules/users/ProfileController::getAction()
This is how I implemented it as well. Not as nice and simple as
rolling a Zend_Controller_Router_Rest, but I basically set up custom
routes and actions and double checked the request method among all
parameters to make sure it played nice.
I think the beauty of the Zend_XmlRpc_* component(s) is that you get
to attach your class code directly and map out methods and so on, so
if this could be taken over into a Zend_Controller_Router_Rest (or
similar), that would be really nice.
Till