eBay API, how to get numerical Site ID from SiteCo

2019-08-02 17:41发布

问题:

In my app I want to give the user the opportunity to choose the site to explore. What I do is showing a list of the existing sites (using a String array) and then get the SiteCodeType with the valueOf() method of the enum.

This value works with some APIs, but what I need is actually the specific ID of the site, and I can't find out how to get it. I hoped to get it somewhere using the SiteCodeType I already have.

I saw both GlobalID and SiteID but I don't understand how to work with them.

https://developer.ebay.com/DevZone/merchandising/docs/CallRef/Enums/GlobalIdList.html https://developer.ebay.com/DevZone/merchandising/docs/Concepts/SiteIDToGlobalID.html

回答1:

This utility converts between SiteCodeType and eBay numerical Site ID.

https://developer.ebay.com/DevZone/javasdk-jaxb/docs/LibRef/com/ebay/sdk/SiteIDUtil.html



回答2:

It's just a simple list with a couple dozen entries: http://developer.ebay.com/DevZone/shopping/docs/CallRef/types/SiteCodeType.html

All ya gotta do is create a simple array in your programming with a 1-to-1 mapping.