Reputation: 31
I am attempting to do a HTTP POST
to retrieve order data from Ebays Trading API. I am somewhat new to this - as you may see. I first used their API Test Tool and was successful getting my actual order data via the Production environment.
I copied the HTTP header info and XML Requestion section, put that in a file, along with what I thought would make it a valid HTTP Post, and then used the Curl executable - called via a batch file.
This did not work - so I changed to a simpler request - GeteBayTime - and got the exact same results.
My batch file is ... (all one line)
Curl -X POST --header "Content-Type:text/xml" -d @postfile https://api.ebay.com/ws/api.dll > out.xml
The postfile is ...
POST / HTTP/1.1
Host: https://api.ebay.com/ws/api.dll
User-Agent: App v1.0
Connection: Keep Alive
Content-Length: 125
Content-Type: text/xml
X-EBAY-API-APP-ID:***-MyReal-APP-ID-here***
X-EBAY-API-VERSION:807
X-EBAY-API-COMPATIBILITY-LEVEL:707
X-EBAY-API-SITE-ID:0
X-EBAY-API-CALL-NAME:GeteBayTime
X-EBAY-API-REQUEST-ENCODING:XML
<?xml version="1.0" encoding="utf-8"?>
<GeteBayTimeRequest xmlns="urn:ebay:apis:eBLBaseComponents">
</GeteBayTimeRequest>
And the result (in out.xml) is ...
<?xml version="1.0" encoding="UTF-8"?>
-<GeteBayOfficialTimeResponse xmlns="urn:ebay:apis:eBLBaseComponents">
<Timestamp>2013-02-04 02:56:43</Timestamp><Ack>Failure</Ack>-<Errors>
<ShortMessage>Unsupported API call.</ShortMessage><LongMessage>The API call
"GeteBayOfficialTime" is invalid or not supported in this release.</LongMessage>
<ErrorCode>2</ErrorCode><SeverityCode>Error</SeverityCode>
<ErrorClassification>RequestError</ErrorClassification></Errors><Build>15743293</Build>
</GeteBayOfficialTimeResponse
Can anyone spot my problem(s) ??
Upvotes: 2
Views: 2498
Reputation: 11
I have the solution - I spend some time to find the right way:
Curl -X POST -H "Content-type: text/xml" -H "X-EBAY-API-COMPATIBILITY-LEVEL:911" -H "X-EBAY-API-SITEID:3" -H "X-EBAY-API-CALL-NAME:GeteBayOfficialTime" -d @postfile.txt https://api.ebay.com/ws/api.dll
Postfile:
<?xml version="1.0" encoding="utf-8"?>
<GeteBayOfficialTimeRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<RequesterCredentials>
<eBayAuthToken>Your Token</eBayAuthToken>
</RequesterCredentials>
</GeteBayOfficialTimeRequest>
Upvotes: 1
Reputation: 11
only request body must be in data -
<?xml version="1.0" encoding="utf-8"?>
<GeteBayTimeRequest xmlns="urn:ebay:apis:eBLBaseComponents">
</GeteBayTimeRequest>
this values must be in header -
X-EBAY-API-APP-ID:***-MyReal-APP-ID-here***
X-EBAY-API-VERSION:807
X-EBAY-API-COMPATIBILITY-LEVEL:707
X-EBAY-API-SITE-ID:0
X-EBAY-API-CALL-NAME:GeteBayTime
X-EBAY-API-REQUEST-ENCODING:XML
Upvotes: 1