For full functionality of this site it is necessary to enable JavaScript.
Here are the instructions how to enable JavaScript in your web browser.

Knowledge base

Find the answer to your question

Advanced Search PView

Search terms
Search Type
Sort by

Using GetSellerList to retreve a seller's items that were not listed in the certain categories in Java SDK

  • Answer ID 719
  • Published 05/22/2015 10:18 AM
  • Updated 05/22/2015 10:18 AM
  • Permalink

How to retrieve a seller's items that are not:
1) Vehicles
2) Real Estate


    You can use PrimaryCategory.CategoryName property to identify an item's listing category.  
     PrimaryCategory.CategoryName is returned in GetSellerList, GetItem and GetBidderList

   As you can see that to accommodate the mentioned use case - be able to filter out the 
certain items based on its listing catetory is to use GetSellerList api call. However; the GetSellerList call returns large amount of data, you need to follow the best practice provided in the KB article Guidelines for using DetailLevel and GranularityLevel in GetSellerList to control the volume of the response.

Detailed Description

  The PrimaryCategory.CategoryName property returns a fully qualified category name like
          Collectibles:Decorative Collectibles,  eBay Motors:Cars Trucks, ..
    as it would appear on the eBay Web site, and  we can then use Java String startWith() api to get the item's most top level Category names like Art, Books, Music ... The below Java code shows how to filter the unwanted items from the
GetSellerList response.

 public void request(ApiContext apiContext){
             String from = "2014-09-19 00:00:00", to = "2014-09-19 23:00:00";
             java.util.Date dtfrom = eBayUtil.fromAPITimeString(from),  dtto = eBayUtil.fromAPITimeString(to);          
             java.util.Calendar calFrom = java.util.Calendar.getInstance(), calTo = java.util.Calendar.getInstance();
             TimeFilter tf = new TimeFilter(calFrom, calTo);
             PaginationType pt = new PaginationType();
             pt.setEntriesPerPage(new Integer("200"));
             pt.setPageNumber(new Integer("1"));
             GetSellerListCall gslc = new GetSellerListCall(apiContext);
             // set the GranulatityLevel to Medium for getting ListingType property
 //execute the GetSellerList call
             ItemType[] retItems = gslc.getSellerList();

             //iterate through the seller's items 
             for (ItemType item : retItems){ 
                   String listingType = item.getListingType().toString();
                   String categoryName = item.getPrimaryCategory().getCategoryName();
  // filter out both the Real Estate and eBay Motors items
// <CategoryName>eBay Motors:Cars Trucks:Honda:Civic</CategoryName>                      
<CategoryName>Real Estate:Land</CategoryName>

                     if( ( ! categoryName.startsWith("Real Estate")) && ( ! categoryName.startsWith("eBay Motors")) ){
     // get the sold items only
                            if ((item.getSellingStatus().getQuantitySold().intValue() !=0)){
                                 System.out.println("item: "+ item.getItemID().getValue() +" is listed in categoryName: [ "+ categoryName+" ]");
                                 System.out.println("Item Current price :" +item.getSellingStatus().getCurrentPrice().getValue());
                                 System.out.println("Item sold: " + item.getSellingStatus().getQuantitySold().intValue());
        }catch(Exception e){}

Version Info

The code example above was based on the versions specified below:

API Schema Version 883
Java SDK Version javasdk v883.0 P


How well did this answer your question?

Answers others found helpful

Print Email This Page Delicious Digg Facebook Reddit StumbleUpon Twitter