状态代码:500 ebay查找api

时间:2016-09-02 00:15:07

标签: ios api ebay

我发送一个简单的请求,使用下面的代码(APP ID已删除)按关键字查询ebay列表。连接似乎没问题,但我得到状态代码:响应500。帮助

NSString *ebayRequestString = @"http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findItemsByKeywords&SERVICE-VERSION=1.12.0&SECURITY-APPNAME=MY_APP_ID&RESPONSE-DATA-FORMAT=XML&REST-PAYLOAD&keywords=harry%20potter%20phoenix&paginationInput.entriesPerPage=2";


    // Encode URL String
NSCharacterSet *set = [NSCharacterSet URLQueryAllowedCharacterSet];
NSString *encodedUrlAsString = [ebayRequestString stringByAddingPercentEncodingWithAllowedCharacters:set];


NSURL *url = [NSURL URLWithString:encodedUrlAsString];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setHTTPMethod: @"POST"];
[request addValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request addValue:[[NSBundle mainBundle] bundleIdentifier] forHTTPHeaderField:@"X-Ios-Bundle-Identifier"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
                                            completionHandler:^(NSData *data, NSURLResponse *response, NSError *error)
                                  {
                                      // do something with the data 
                                      NSString* strData = [[NSString alloc] initWithData:self.receivedData encoding:NSUTF8StringEncoding];
                                      NSLog(@"Updating with eBay data....\n%@", strData);
                                  }];
[dataTask resume];

<NSHTTPURLResponse: 0x128b2cbf0> { URL: http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findItemsByKeywords&SERVICE-VERSION=1.12.0&SECURITY-APPNAME=MY_APP_ID&RESPONSE-DATA-FORMAT=XML&REST-PAYLOAD&keywords=harry%2520potter%2520phoenix&paginationInput.entriesPerPage=2 } { status code: 500, headers {
Connection = "keep-alive";
"Content-Encoding" = gzip;
"Content-Type" = "text/xml;charset=UTF-8";
Date = "Fri, 02 Sep 2016 00:03:47 GMT";
GUID = "156e8356-1230-a7ea-0622-28c2e7d0f7ab";
Server = "Apache-Coyote/1.1";
"Transfer-Encoding" = Identity;
"X-Cnection" = close;
"X-EBAY-REQUEST-ID" = "156e8356-1230-a7ea-0622-28c2e7d0f7ab!services.search.FindingService.v1!10.126.160.98!fndngesb[]";
"X-EBAY-SOA-ERROR-RESPONSE" = TRUE;
"X-EBAY-SOA-LOCALE-LIST" = "en-US_US";
"X-EBAY-SOA-MESSAGE-PROTOCOL" = NONE;
"X-EBAY-SOA-OPERATION-NAME" = findItemsByKeywords;
"X-EBAY-SOA-REQUEST-ID" = "156e8356-13c0-a34c-5635-0d65fc048eb4";
"X-EBAY-SOA-RESPONSE-DATA-FORMAT" = XML;
"X-EBAY-SOA-SERVICE-METRICS" = 7665214;
"X-EBAY-SOA-SERVICE-NAME" = "{http://www.ebay.com/marketplace/search/v1/services}FindingService";
"X-EBAY-SOA-SERVICE-VERSION" = "1.13.0";
} }

0 个答案:

没有答案