lundi 24 mars 2014

Receiving error stating that one of the params in my httpRequest is not defined


Vote count:

0




What I'm trying do is take whatever query a user types into the itemSearch field, ping eBay's database, and return the categoryID with the most results. Upon testing however, I'm receiving the following error:



[9067:3603] Error: Uncaught Error: Can't set params if there is already a query parameter in the url (Code: 141, Version: 1.2.18)


Removing the quotes around the params didn't fix the problem, and I get the feeling it's because I'm not formatting the params properly in order to take in a value from the objective-c code. Any help would be appreciated!


My cloud code is structured like so:



Parse.Cloud.define("eBayCategorySearch", function(request, response) {
url = 'http://ift.tt/1lh2y9i ID GOES HERE*';

Parse.Cloud.httpRequest({
url: url,
params: {
'OPERATION-NAME' : 'findItemsByKeywords',
'SERVICE-VERSION' : '1.12.0',
'RESPONSE-DATA-FORMAT' : 'JSON',
'callback' : '_cb_findItemsByKeywords',
'itemFilter(3).name=ListingType' : 'itemFilter(3).value=FixedPrice',
'keywords' : 'request.params.item',

// your other params
},
success: function (httpResponse) {
// deal with success and respond to query
},
error: function (httpResponse) {
console.log('error!!!');
console.error('Request failed with response code ' + httpResponse.status);
}
});
});


and I call the function from within my iOS app like so:



- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if (sender != self.nextButton) return;
if (self.itemSearch.text.length > 0) {

[PFCloud callFunctionInBackground:@"eBayCategorySearch"
withParameters:@{@"item": self.itemSearch.text}
block:^(NSNumber *category, NSError *error) {
if (!error) {NSLog(@"Successfully pinged eBay!");
}

}];


}

// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.

}


asked 48 secs ago






Aucun commentaire:

Enregistrer un commentaire