Skip to main content
Published: March 29 2006, 3:03:00 PMUpdated: July 22 2022, 11:27:29 AM

if the item has been ended without being sold, how would I find out its status.

To find out whether an item is ended without being sold, you can put the below condition in place when looping through a returned item array from GetSellerList api call:
if ( (ItemType.SellingStatusType.ListingStatusCodeType.Completed) &&( ItemType.SellingStatusType.quantitySold==0)).

The sample below shows of using GetSellerListCall wrapper to retrieve the items ended successfully and also the ones not being sold.

// Setting the time range
String from = "2022-02-01 00:00:00";
String to = "2022-02-03 23:00:00";
java.util.Date dtfrom = eBayUtil.fromAPITimeString(from);
java.util.Date dtto = eBayUtil.fromAPITimeString(to);
java.util.Calendar calFrom = java.util.Calendar.getInstance();
java.util.Calendar calTo = java.util.Calendar.getInstance();
calFrom.setTime(dtfrom);
calTo.setTime(dtto);
TimeFilter tf = new TimeFilter(calFrom, calTo);

PaginationType pt = new PaginationType();
pt.setEntriesPerPage(new Integer("100"));
pt.setPageNumber(new Integer("1"));

// create GetSellerListCall object
GetSellerListCall api = new GetSellerListCall(apiContext);
DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] {
DetailLevelCodeType.ReturnAll
};
api.setDetailLevel(detailLevels);

api.setPagination(pt);
api.setStartTimeFilter(tf);
api.setEndTimeFilter(tf);
api.setUserID(new UserIDType(SELLERID));

//execute the api call
ItemType[] retItems = api.getSellerList();

for (ItemType item : retItems) {
ItemType item = retItems;
ItemIDType itemId = item.getItemID();
SellingStatusType sst = item.getSellingStatus();
ListingStatusCodeType lsct = sst.getListingStatus();
int quantitySold = sst.getQuantitySold().intValue();

if (lsct.equals(ListingStatusCodeType.Completed)) {
if ( quantitySold ==0) {
System.out.println(" The Item " + itemId.toString() + " is UNSOLD " );
}else {
System.out.println(" The Item " + itemId.toString() + " is SOLD. The qty is : " +quantitySold );
}
}
}

NOTE. ListingStatusCodeType was not available when the JAVA SDK1.2 was released (WSDL 419) so one needs to rebuild the JAVA SDK1.2 with the latest WSDL for the class to be included..
 

 

How well did this answer your question?
Answers others found helpful

Got thoughts? Click the feedback button – your insights help us improve!