question

askh5373 avatar image
1 Like"
askh5373 asked

Ebay Product API Empty Response

I am working on a project that requires access to eBay’s Product API. I am using the getProductDetails call trying to get the fields containing eBay identification numbers (such as ePID, ISBN, GTIN, etc).

I tried two methods to get this call to produce the fields that I need, but I am only getting a "success" return but with no other details for the Python method and a 500 html response for the XML method. The two methods (XML and Python) I have tried so far are in working examples below. The keys I have obtained from Ebay are: appid, cevid, certid and token, which are saved in a .env file in the same directory as my code files.

I've spent days staring at the incomplete EBay API documentation, and EBay customer support pointed by to the EBay SDK package, which does not interface with the Product API.

Here's the Python GET request method:

root = 'https://svcs.ebay.com' endpoint = '/services/marketplacecatalog/ProductService/v1'  headers = {
   'X-EBAY-API-IAF-TOKEN': 'Bearer ' + OAuth,               'Content-Type': 'application/x-www-form-urlencoded',               'X-EBAY-SOA-RESPONSE-DATA-FORMAT':'JSON',               'X-EBAY-SOA-SECURITY-APPNAME': AppID}      params = {
   'X-EBAY-SOA-OPERATION-NAME': 'getProductDetails',               'productDetailsRequest':'[0..*]',               'productDetailsRequest.productIdentifier.ePID':'EPID'+’115115562893’} #example ePID 
r = requests.get(root+endpoint, headers=headers, params=params)

I expected output with the Product Details, especially GTIN and other identifiers, but instead I got:

{
   'getProductDetailsResponse': [{
   'ack': ['Success'],    'version': ['1.3.1'],    'timestamp': ['2021-12-02T17:34:18.510Z']}]} 

With the XML POST method, the code is:

root = 'https://svcs.ebay.com' endpoint = '/services/marketplacecatalog/ProductService/v1' target_url = root + endpoint  xml_request = """<?xml version="1.3.1" encoding="utf-8"?> <getProductDetailsRequest>   <productDetailsRequest>         <productIdentifier>          <ePID>EPID115115562893</ePID> #random ePID number        </productIdentifier>       <dataset>DisplayableProductDetails</dataset>   </productDetailsRequest> </getProductDetailsRequest>"""  headers = {
   'X-EBAY-API-IAF-TOKEN': 'Bearer ' + OAuth,           'Content-Type': 'application/x-www-form-urlencoded',            'Version': '1.3.1',           'X-EBAY-SOA-RESPONSE-DATA-FORMAT':'JSON',           'X-EBAY-SOA-SECURITY-APPNAME': AppID}  r = requests.post(target_url, data=xml_request, headers=headers) 

However this produces a 500 HTTP response.

I would be grateful for any help making a call that returns the eBay product identification numbers (ePID, ISBN, GTIN, etc). Thank you

pythonxml
· 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.

In a similar situation, wasted time in the trading API only to get a response saying you can't use GetItem, unless you are the seller. Either I'm an idiot or I missed that bit about the Trading API. Using Python ebaydsk as well, haven't tried requests yet for the Product API, but will see what happens. Interested if you get that working.
0 Likes 0 ·

0 Answers

· Write an Answer

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.