ZF-7896: Does zend_rest_route respect RESTful protocol stand

Issue Type: Bug Created: 2009-09-19T08:40:10.000+0000 Last Updated: 2009-12-30T10:49:09.000+0000 Status: Resolved Fix version(s): - 1.9.7 (11/Jan/10)

Reporter: jean-rubin (jrleonard) Assignee: Luke Crouch (lcrouch) Tags: - Zend_Rest_Route

Related issues: Attachments:


Hi, from my understanding of RESTful protocol, the server side is supposed to accept a request like this: /REST/1 It should also be able to interpret /REST/?id=1 or /REST/type="x"

In the current implementation however we can only do the first kind of url. Is it up to us to test for is sent and act accordingly? JR


Posted by Matthew Weier O'Phinney (matthew) on 2009-09-19T09:21:36.000+0000

Typically, ReST says that there should be a single URI for any given resource, and that it should be returned in the Location header on successful creation. While it may be useful to support both styles, it would also add significant complexity for very little benefit.

Luke, any thoughts on this?

Posted by Luke Crouch (lcrouch) on 2009-09-19T17:04:50.000+0000

You should already be able to send a request like:


If that's not working, it's a bug and I'll fix it.

As for the other URI, it could (and probably should?) be expressed:


I'd like to see the context for an identifier like /REST/type="x". I've never seen query params supplied like that without a '?' character in a URI.

Posted by jean-rubin (jrleonard) on 2009-09-20T04:16:41.000+0000

In the case you have a table like ID name type 1 bar type1 2 baz type2 3 foo type2 4 bat type1

/rest/1 should give you the data pertaining to the row with id 1 and so on. /rest/?id=1 should give the same as /rest/1 but currently that doesn't work (I have build 18038)

/rest/?type=2, which I figure should return 2 baz type2 and 3 foo type2 doesn't work either but I suspect it might not be RESTful. I was just looking for confirmation. JR

Posted by Luke Crouch (lcrouch) on 2009-09-22T09:51:42.000+0000

Ah, in that case if you want to return more than one resource, Zend_Rest_Route and Zend_Rest_Controller are designed to do so like this:


Which will route to RestController::indexAction() with type=>type2 parameter, which you can then use to query the DB where type = 'type2' and go from there.

I'll recreate a test for the /rest/?id=1 and try to get that fixed. In the meantime, try using /rest/1

Thanks, -L

Posted by Luke Crouch (lcrouch) on 2009-12-30T10:49:08.000+0000

Fixed support for ?param=value query param values.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.