Thanks Jochen and J.Shirley, What I was trying to do is access parameters from the URL so i could have a REST interface, something like
http://foo.bar.com/rest/v1/db/source_destination_mapt/1/destination_account/2 I ended up doing something like this sub source_destination_map :Local :ActionClass('REST') { my $self = shift; my $c = shift; $c->stash(source_account => shift); $c->stash(@_); } and then access the parameters from the URI like this: sub source_destination_map_GET { } sub source_destination_map_POST { my $source_account = $c->{stash}->{source_account}, my $destination_account = $c->{stash}->{destination_account} } Are there some gotchas that i might be missing as a result of handling the parameters like this for POST/PUT requests? -Hani On Fri, Jul 25, 2008 at 7:23 AM, J. Shirley <[EMAIL PROTECTED]> wrote: > On Fri, Jul 25, 2008 at 1:48 AM, Jochen Luig <[EMAIL PROTECTED]> wrote: > > Hi Hani, > > > >> var postData = > "source_account=1&destination_account=2&ingestor_id=10&source_id=1" > >> > > I think this is where it fails. As far as I can tell from your code, > > postData should contain a JSON Object. > > Try something like: > > > > var postData = '{ "source_account": "1", "destination_account": "2", > > "ingestor_id": "10", "source_id": "1" }'; > > > > > > On another note, make sure that YAHOO.util.Connect.asyncRequest doesn't > > mess up your request somehow (is that YUI, btw?). I've just experienced > > the same annoyance with Dojo, whose dojo.xhrPost is not exactly fond of > > sending JSON-Objects. It helps to look at the request itself with some > > tool like e.g. wireshark. > > > > HTH, > > > > Jochen > > > > > > Right, Hani is sending url form encoded post body, which is not JSON > and will fail to be processed as JSON data. YUI can be used to > generate your JSON data, please read the documentation at > http://developer.yahoo.com/yui/json/ > > asyncRequest will not mess up any requests, I've thoroughly used YUI > in conjunction with C::C::REST and it has never let me down (IE6 is a > different story). As long as you stick to POST and GET, IE6 will be > fine. > > Also, using Dumper inside of your controller is not recommended, > simply use the $c->log->_dump command. Additionally, using > $c->req->body is what C::C::REST uses, and after the deserialization > the data will be in $c->req->data and a simple: > $c->log->_dump( $c->req->data ); > shows what exactly is in the request data that has been deserialized for > use. > > _______________________________________________ > List: Catalyst@lists.scsys.co.uk > Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst > Searchable archive: > http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ > Dev site: http://dev.catalyst.perl.org/ >
_______________________________________________ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/