Hello, I am having trouble getting deserialize to work correctly in the REST interface that i am building out.
Here's the info: the debug message i get when running the catalyst server prints out: [debug] I would have deserialized, but there was nothing in the body! looks like nothing is returned in the call made by the REST JSON plugin line 34 $c->request->body but also in the debug log is the following: [debug] Body Parameters are: .-------------------------------------+--------------------------------------. | Parameter | Value | +-------------------------------------+--------------------------------------+ | destination_account | 2 | | ingestor_id | 10 | | source_account | 1 | | source_id | 1 | '-------------------------------------+--------------------------------------' Here's the javascript that submits the request: var sUrl = "/rest/db/source_destination_map/"; var postData = "source_account=1&destination_account=2&ingestor_id=10&source_id=1" function makeRequest(){ YAHOO.util.Connect.initHeader('Content-Type', 'application/json', null); YAHOO.util.Connect.initHeader('X-authkey', 'd72fc6813c5618876309e3f8cbc7b741', null); var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData); YAHOO.log("Initiating request; tId: " + request.tId + ".", "info", "example"); } and trying to access $c->request->data in my REST here's the begin: sub begin : ActionClass('Deserialize') { my ($self, $c) = @_; if ( $self->_auth_private_web_service( $c ) ){ }else{ $c->res->status(403); $c->res->body("You are not authorized to use the private REST API."); $c->detach(); } } and the method: sub source_destination_map_POST { my ($self, $c) = @_; my ( $source_destination_map, $source_ingestor_destination_map ); my @params = %{$c->request->params}; my $l = $c->request->body; print STDERR "BODY " . Dumper $l; ... returns the following: BODY $VAR1 = undef; So, I can see that the request object also has the body_params method which I am guessing is where the key value pairs of the parameters is being passed, but the JSON deserializer seems to try to retrieve it from $c->request->body, As a result attempting to access things via $c->request->data in my source_destination_map_POST method does not work. many thanks for looking at this, -hani
_______________________________________________ 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/