Page 1 of 1

Using tsNetPost

Posted: Fri Jul 24, 2020 11:20 pm
by JackieBlue1970
Good afternoon and happy Friday.

I'm doing some testing with LC and the eBay XML API. Basically involves a POST to eBay's server. I'm testing with a simple request - GetOfficialEbayTime (yes it says get but all the eBay requests are POST). I've tested my XML in eBay's API Explorer which allows me to paste my XML code. This was successful. However, using the same headers (and variations to test) and XML it fails using LC's lesson code sample format:

Code: Select all

put "X-EBAY-API-COMPATIBILITY-LEVEL:  '1149'" into xCompatLevel  
   put "X-EBAY-API-DEV-NAME: " & devID into xDevID
   put "X-EBAY-API-APP-NAME: " & appID into xAppID
   put "X-EBAY-API-CERT-NAME: "& certID into xCertID
   put "X-EBAY-API-CALL-NAME: GeteBayOfficialTime"  into xAPICALL  //only interested in message request at this point
   put "X-EBAY-API-SITEID:  0" into xSiteID  //defaulted to USA
   put "content-type: text/xml" into xContent //default text/xml content
   
   /*create request*/
   put xCompatLevel & " " & xDevID & " " & xAppID & " " & xCertID & " " & xAPICALL & " " & xSiteID & " " & xContent & " Request Payload:  " into Header
   
   /*build request*/
   put "<?xml version='1.0' encoding='utf-8'?>" into xStep1
   put xStep1 & "<GeteBayOfficialTimeRequest xmlns='urn:ebay:apis:eBLBaseComponents'>" into xStep2
   put xStep2 & "<RequesterCredentials><eBayAuthToken>xyz....zyx</eBayAuthToken></RequesterCredentials>" into xStep2a
   put xStep2a & "<ErrorLanguage>en_US</ErrorLanguage>" into xStep3
   put xStep3 & "<WarningLevel>High</WarningLevel>" into xStep4
   put xStep4 & "</GeteBayOfficialTimeRequest>" into xPayload



put tsNetPost("connectionA",serverURL,xHeader,xPayload,"postResponse") into tError  
I keep getting errors similar to this:

Image




Any ideas? I suspect it is something to do with how the requests are formatted since I know the XML is correct. TIA.

Re: Using tsNetPost

Posted: Sat Jul 25, 2020 6:58 pm
by jacque
No idea really, but have you tried the more generic POST command instead of TSNetPost?

Edit: This looks like a good candidate for the merge function when creating the xml.

Re: Using tsNetPost

Posted: Sun Jul 26, 2020 2:16 am
by JackieBlue1970
Thank you. Can’t hurt. I’ll give it try on Monday. I thought I saw something in the forums that the POST command was not preferred though.

Re: Using tsNetPost

Posted: Sun Jul 26, 2020 6:24 am
by jacque
JackieBlue1970 wrote:
Sun Jul 26, 2020 2:16 am
Thank you. Can’t hurt. I’ll give it try on Monday. I thought I saw something in the forums that the POST command was not preferred though.
It's all I've ever used, and I've never had any issues with it. I'm not sure why it wouldn't be preferred, I don't remember seeing that anywhere.