Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

As per the this Cakephp CookBook the simple setup for RESTful api :

HTTP Method     URL.method  Controller action invoked
GET     /recipes*.method*   RecipesController::index()
GET     /recipes/123.method     RecipesController::view(123)
POST    /recipes*.method*   RecipesController::add()
PUT     /recipes/123*.method*   RecipesController::edit(123)
DELETE  /recipes/123.method     RecipesController::delete(123)
POST    /recipes/123*.method*   RecipesController::edit(123)

here all the URL parameters are numeric i.e 123. When I tried with the string i.e

GET     /recipes/test.json  RecipesController::view(123)

this gives me an error :

{
   code: "404"
   url: "/myproject/recipes/test.json" // don't work 
   name: "Action RecipesController::test() could not be found."
}

here the URL

     "/myproject/recipes/test.json" // doesn't work

but 
      "/myproject/recipes/123.json" // works 

I used the default Router::mapResources('recipes')

I know this can be done by the Custom REST Routing but I want this to be done with the defalut mapResources() only, is it possible ?

Thanks in advance!

share

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.