skip to Main Content

I’m trying to get UPC of item returned by GetSellerList call using eBay Trading API.

I’m able to successfully execute the API call using this code:

public void getSellerItemsList() throws ApiException, SdkException, Exception
{
    String EBayProfile = "XXXXXXXXXXXX";
    String sellerID = "XXXXXXXXXXXXXX"; 
    ApiContext apiContext = getAPIContext(EBayProfile);

    GetSellerListCall getSellerList  = new GetSellerListCall ();
    getSellerList.setApiContext(apiContext);



    DetailLevelCodeType[] detailLevelCodeType = new DetailLevelCodeType[1];
    detailLevelCodeType[0] = DetailLevelCodeType.RETURN_ALL;
    getSellerList.setDetailLevel(detailLevelCodeType);






    Calendar fromTime = Calendar.getInstance();
    fromTime.add(Calendar.DAY_OF_MONTH, -3);

    Calendar toTime = Calendar.getInstance();
    toTime.setTime(Calendar.getInstance().getTime());


    TimeFilter startTimeFilter = new TimeFilter(fromTime, toTime);
    getSellerList.setStartTimeFilter(startTimeFilter);


    getSellerList.setUserID(sellerID);
    getSellerList.setEnableCompression(true);
    WarningLevelCodeType warningLevel = WarningLevelCodeType.HIGH;
    getSellerList.setWarningLevel(warningLevel);


    PaginationType paginationType = new PaginationType();
    paginationType.setEntriesPerPage(199);
    paginationType.setPageNumber(1);


    ItemType[] items = getSellerList.getEntireSellerList();




    for (ItemType item : items) {
        System.out.println("nTitle: " + item.getTitle());


        // For some reason this value is always equal to null (never prints)
        if (item.getAttributeArray() != null) {

            AttributeArrayType attributeType = item.getAttributeArray();
            System.out.println("Attributes length: " + attributeType.getAttributeLength());

        }


        // For some reason this value is always equal to null (never prints)
        if (item.getProductListingDetails() != null) {
            UPC = item.getProductListingDetails().getUPC();
            System.out.println("UPC: " + UPC);  
        }  

        // For some reason this value is always equal to null (never prints)
        if (item.getVariations() != null) {
            VariationsType itemVariations = item.getVariations();

            for (int x = 0; x < itemVariations.getVariationLength(); x++) {
                VariationType variation = itemVariations.getVariation(x);
                VariationProductListingDetailsType variationListingDetails = variation.getVariationProductListingDetails();
                UPC = variationListingDetails.getUPC(); // UPC always missing

            }

        }




        // For some reason this value is always equal to null (never prints)
        if (item.getItemSpecifics() != null) {
            NameValueListArrayType itemSpecifics = item.getItemSpecifics();
            NameValueListType[] nameValueList = itemSpecifics.getNameValueList();


            }
        }
    }


}

Call executes successfully but the UPC is empty (no matter where I try to extract it from, as seen in previous code).

eBay Docs clearly state this call returns UPC.

What am I doing wrong?

2

Answers


  1. GetSellerList not includes the item specifics.

    You have to use eBay shopping API call- GetSingleItem with IncludeSelector – ItemSpecifics to get UPC for each item in GetSellerList result

    Login or Signup to reply.
  2. "This field is no longer returned in the GetSingleItem or
    GetMultipleItems calls. To view the eBay Product ID (also known as an
    ePID) or Global Trade Item Number (UPC, EAN, ISBN, or MPN) for a
    product in a listing (or product variation within a multiple-variation
    listing), use the Trading API’s GetItem call instead."

    https://developer.ebay.com/devzone/shopping/docs/callref/getsingleitem.html

    But the Trading API’s GetItem is not shared for all users. You can see only your own items

    For MPN you can try a call like this "http://open.api.ebay.com/shopping?callname=GetSingleItem&IncludeSelector=ItemSpecifics&responseencoding=XML&appid=XXXX&siteid=0&version=967&ItemID=111111111111&quot;.
    It still works no matter what

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search