ios - Receiving error stating that one of the params in my httpRequest is not defined -
what i'm trying take whatever query user types itemsearch field, ping ebay's database, , return categoryid results. upon testing however, i'm receiving following error:
[9067:3603] error: uncaught error: can't set params if there query parameter in url (code: 141, version: 1.2.18) removing quotes around params didn't fix problem, , feeling it's because i'm not formatting params in order take in value objective-c code. appreciated!
my cloud code structured so:
parse.cloud.define("ebaycategorysearch", function(request, response) { url = 'http://svcs.ebay.com/services/search/findingservice/v1?security-appname=*app 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', // other params }, success: function (httpresponse) { // deal success , respond query }, error: function (httpresponse) { console.log('error!!!'); console.error('request failed response code ' + httpresponse.status); } }); }); and call function within ios app 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!"); } }]; } // new view controller using [segue destinationviewcontroller]. // pass selected object new view controller. }
the error message tells wrong.
you have defined url
url = 'http://svcs.ebay.com/services/search/findingservice/v1?security-appname=*app id goes here*'
but contains query string (the bit after "?"), error message.
you need set url url = "http://svcs.ebay.com/services/search/findingservice/v1"
and add
"security-appname" : "*app id goes here*"
to params dictionary
Comments
Post a Comment