question

rschluet9 avatar image
0 Likes"
rschluet9 asked ·

GetCategoryFeatures call returns code = -1005, connection lost on Mac OSX

I am working on a Mac running OS X. There is no SDK, so I am writing request using XML. I am working in the sandbox. URL: https://api.sandbox.ebay.com/ws/api.dll/trading Headers: "Content-Type" = "text/xml"; "X-EBAY-API-APP-NAME" = "rSchluet-3804-45xyz"; "X-EBAY-API-CALL-NAME" = GetCategoryFeatures; "X-EBAY-API-CERT-NAME" = "8b9c20b6-ac27-xyz"; "X-EBAY-API-COMPATIBILITY-LEVEL" = 947; "X-EBAY-API-DEV-NAME" = "f439d820-9319-xyz; "X-EBAY-API-SITEID" = 0; "X-EBAY-SOA-SECURITY-TOKEN" = "AgAAAA**AQA..." The XML: AgAAAA**AQAAAA**xxxxxxzbbaA ReturnAll en_US High 179697 947 Error: Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={NSUnderlyingError=0x61800024ad10 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={_kCFStreamErrorCodeKey=-4, _kCFStreamErrorDomainKey=4}}, NSErrorFailingURLStringKey= https://api.sandbox.ebay.com/ws/api.dll/trading, NSErrorFailingURLKey= https://api.sandbox.ebay.com/ws/api.dll/trading, _kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-4, NSLocalizedDescription=The network connection was lost.} This is using the "Get" HTTPMethod. The documentation for the Trading API says: "The Trading API expects calls to use the HTTP POST call method." So, I changed it to POST. No error, but no results, so I'm switching back to "Get".
getcategoryfeaturesmacosx
· 1
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hi, Does it happen for only this API Call or for all the Trading API Calls? Cheers!!!
0 Likes 0 · ·
rschluet9 avatar image
0 Likes"
rschluet9 answered ·
I have resolved this issue. Solution: the call needs to be: NSURLSessionDataTask* dataTask = [session uploadTaskWithRequest:request fromData:nil completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { NSLog(@"error: %@", error); NSLog(@"response: %@", response); NSString* dataAsString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; NSLog(@"dataAsString: %@", dataAsString); } and this: request.HTTPMethod = @"POST"; It appears that even though I am requesting data, the request needs to be a POST. The previous code: NSURLSessionDataTask* dataTask = [session dataTaskWithRequest:request .... returns an NSURLSessionDataTask. my new code: NSURLSessionDataTask* dataTask = [session uploadTaskWithRequest:request... returns an NSURLSessionUploadTask, which is required for 'POST' requests.
· Share
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

rschluet9 avatar image
0 Likes"
rschluet9 answered ·
@shrut_h asked if this was the only call failing on the trading api. I have only attempted one other call in trading and that is VerifyAddItem, which executes ok, but the response indicates I have some field values invalid for this category type, which is why I am now calling GetCategoryFeatures. eBay support suggested changing the endpoint to: https://api.sandbox.ebay.com/ws/api.dll which I did, but it made no difference. Waiting to hear their next suggestion. BTW, @shrut_h, I received an email with your comment, but it doesn't show up here for me. Oh, I see it now, I had to do a click.
· Share
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.