04-19-2024 09:39 AM
I am trying to write my first eBay application with Python and am quite lost when it comes to all the authorization/token stuff. For my first application, I just want to retrieve the currently active auctions I have posted myself as a seller. So the only user for this application is me, and the only data I am interested in retrieving is for my own auctions. Is there someplace I can find a simple example of how to do this? Do I really need to implement branded login screens and add code to do token requesting on a 2-hour repeating basis just to do this?
04-19-2024 04:43 PM
I assume you already have a developer account, my solution focused on C# but steps should help you to get started.
https://github.com/CMS365-PTY-LTD/EbaySharp?tab=readme-ov-file#access-and-security
04-19-2024 05:16 PM
Yes, I have a developer account. I was hoping to avoid the complexities of the 0Auth mechanism and use the Auth'n'Auth mechanism instead, but I guess that won't work? Since I am working in Python with the requests package, all the C# code involving IdentityControllers is just Greek to me and isn't something I can translate to my Python code base on my own.
04-20-2024 04:43 PM
So I managed to get a working OAuth access token, or at least what seems to be one. I don't get errors when I try to retrieve data from the inventory_item API endpoint. But all I get, after converting the JSON response, is a dictionary of {'total': 0, 'size': 0} when I have three active auctions running right now.
04-20-2024 05:20 PM
From what I gather, only listings created with the Inventory API will be retrieved by the Inventory API. Auctions created through the eBay website itself do not show up in the Inventory API. So I tried to use the Browse API and the getItems method and I get a 403 Insufficient permissions error even though I am using a newly generated 0Auth user token with the API Explorer. Trying to figure out which API to use, and what kind of token to use to make this work is extremely frustrating.
04-20-2024 05:31 PM
Trying the getItem method (instead of getItems) succeeds, at least in the sense that I don't hit the insufficient permissions error response, but when I supply the itemID of a currently active listing (one of my own), the response is 404 "The specified item Id was not found." Do I need to alter the HTTP Headers in the API Explorer manually to get these test calls to work?
04-20-2024 06:03 PM
If your listing items have already been created by UI in browser or old Inventory API, then you can't use new REST API, REST API can be used for listings created by REST API.
You will first need to migrate the listings to REST API and then you can use REST API operations.
04-20-2024 06:14 PM
Turns out that item ids as shown on the website are not the same thing as item ids to the REST APIs. However, the getItemByLegacyId method works with item ids from the site listings. Now I just need to figure out a way to get the API to give me a list of active item ids (for me as the seller).