How do I determine if an item is ended in my WatchList in GetMyeBayBuying?
Answer
Detailed Description
You can check the Item.TimeLeft property to determine if the item in question is ended. For ended listings, the time left is PT0S (zero seconds).
In Java SDK Jaxb version, ItemType.getTimeLeft() is returned in Duration java object. ItemType.getTimeLeft().getSign() returns 0 for ended item :
Here is the sample GetMyeBayBuying code:
DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[]{
DetailLevelCodeType.RETURN_ALL
};
GetMyeBayBuyingCall gmes = new GetMyeBayBuyingCall(apiContext);
gmes.setDetailLevel(detailLevels);
ItemListCustomizationType ilct = new ItemListCustomizationType();
gmes.setWatchList(ilct);
try {
gmes.getMyeBayBuying();
PaginatedItemArrayType returnedWonList = gmes.getReturnedWatchList();
if (returnedWonList !=null){
ItemArrayType iat = returnedWonList.getItemArray();
ItemType[] items = iat.getItem();
for (ItemType item : items){
Duration duration =item.getTimeLeft();
// 0 if the duration is zero, and 1 if the duration is positive.
if ( duration.getSign()==0){
// item is ended
// your business logic goes here
}
}
}
} catch (Exception e) {
// handle exception here
}
How well did this answer your question?
Thank you for helping us to improve the eBay developer program.
While we are not able to respond directly to your comments, we will carefully review them to improve your experience with eBay developer program!