<unknown file =“”>中的意外令牌_:1 </unknown>

时间:2014-05-21 16:19:33

标签: javascript objective-c parse-platform ebay

我试图在Parse上运行一个云端代码功能,它会点击eBay,我收到了这个相当神秘的错误。不确定代码中的哪个位置可以查找问题。

Cloud Code:

Parse.Cloud.define("eBayMatchCenterSearch", function(request, response) {
          url = 'http://svcs.ebay.com/services/search/FindingService/v1';

  Parse.Cloud.httpRequest({
      url: url,
      params: {   
       'OPERATION-NAME' : 'findItemsByKeywords', 
       'SERVICE-VERSION' : '1.12.0',
       'SECURITY-APPNAME' : '*APP ID GOES HERE*',
       'GLOBAL-ID' : 'EBAY-US',
       'RESPONSE-DATA-FORMAT' : 'JSON',
       'callback': '_cb_findItemsByKeywords',
       'itemFilter(0).name=ListingType' : 'itemFilter(0).value=FixedPrice',
       'REST-PAYLOAD&sortOrder' : 'PricePlusShippingLowest',
       'paginationInput.entriesPerPage' : '3',
       'outputSelector=AspectHistogram&itemFilter(0).name=Condition&itemFilter(0).value(0)' : request.params.itemCondition,
       'itemFilter(1).name=MaxPrice&itemFilter(1).value' : request.params.maxPrice,
       'itemFilter(1).paramName=Currency&itemFilter(1).paramValue' : 'USD',
       'itemFilter(2).name=MinPrice&itemFilter(2).value' : request.params.minPrice,
       'itemFilter(2).paramName=Currency&itemFilter(2).paramValue' : 'USD',
       'itemFilter(3).name=LocatedIn&itemFilter(3).Value' : request.params.itemLocation,
       'keywords' : request.params.item,


     },
      success: function (httpResponse) {


// parses results

          var httpresponse = JSON.parse(httpResponse.text);

          response.success(httpresponse)
          console.log('MatchCenter Pinged eBay dude!')

  },
          error: function (httpResponse) {
              console.log('error!!!');
              response.error('Request failed with response code ' + httpResponse.status);
          }
     });
});

触发该功能的Objective-C:

- (void)viewDidLoad
{

    [super viewDidLoad];



    //perform search with criteria just submitted
        [PFCloud callFunctionInBackground:@"eBayMatchCenterSearch"
                           withParameters:@{@"item": @"iPhone 5 16gb",
                                            @"minPrice": @"250",
                                            @"maxPrice": @"400",
                                            @"itemCondition": @"New",
//                                            @"itemLocation": @"US",
                                            }
                                    block:^(NSString *result, NSError *error) {

                                        if (!error) {
                                            NSLog(@"The result is '%@'", result);
                                        }
                                    }];

}

编辑:

在评论'callback': '_cb_findItemsByKeywords'之后,认为可能存在问题的下划线,我收到了此JSON回复:

    {"findItemsByKeywordsResponse":[{"ack":["Failure"],"errorMessage":[{"error":[{"errorId":["46"],"domain":["Marketplace"],"severity":["Error"],"category":["Request"],"message":["Value is required for item filter, MAX_PRICE."],"subdomain":["Search"],"parameter":["MAX_PRICE"]}]}],"version":["1.12.0"],"timestamp":["2014-05-21T16:47:21.351Z"]}]}
I2014-05-21T16:47:21.405Z] 

0 个答案:

没有答案