[Catalyst] RESTy Chained actions

John Lifsey - Contractor - 5595 john.lifsey at nrl.navy.mil
Fri Jun 25 15:02:51 GMT 2010


Is there any way to chain actions such that they can be endpoints or 
intermediate steps?

For example:

I want to have a REST controller that allows these URLs to work using 
ActionClass REST and Chained

http://myapp.com/car - dispatch to sub car_GET for list of cars

http://myapp.com/car/corvette - dispatch to car_GET for a single record

http://myapp.com/car/corvette/model - dispatch to sub model_GET chained 
to sub car{} for a list of corvette types

http://myapp.com/car/corvette/model/Z06 - dispatch to sub model_GET 
chained to sub car{} for a single corvette type record

something like this doesn't quite work:

sub car :ActionClass('REST') Chained CaptureArgs(1) {}
sub model :ActionClass('REST') Chained('car') Args(1) {}

So my question: Is there a Chained incantation to allow all of the 
following to be endpoints?

/car
/car/aCarID
/car/aCarID/model
/car/aCarID/model/aModelID

Or am I just DoingItWrong all together?



More information about the Catalyst mailing list