Guillaume,
> Two special parameters are checked when processing requests in Zend_Rest_Route:
>  "new" and "edit" (in the match() method).
>
>  What is the purpose of those special GET URI's?
>
>  I would like to use the "new" parameter to get the initial state of
>  a resource and try to figure if it is the right way to do so.
"new" is used to display an HTML form for entering data for a new
resource. The reason it is included is because GET will return a list of
resources; having the "new" parameter will allow you to do a GET request
that gives you that form.

"edit" is similarly for display of a form for updating an existing
resource. In this case, you have an ID, so normally GET would give you
that resource; adding the "edit" parameter allows you to retrieve the
edit form.
Thank you Matthew.

As I use an MVC controller to retrieve the HTML form, I'll use the REST one with the "new" parameter to get the resource initial state.
That is actually not intended. When creating a resource, your application should reply with an url (e.g. location header) where the created resource can be found. You should then go and GET the new resource, not with the "new" param.

Regards
Christian
--
Guillaume ORIOL


Reply via email to