Skip to main content
Published: June 30 2005, 9:30:00 AMUpdated: November 28 2020, 1:25:57 PM

How do I find the items that ended successfully and also the ones that ended but did not sell?

How do I find the items that ended successfully and also the ones that were notsuccessful in selling?

Using GetSellerTransactions you can get all the transactions for the itemsthat sold successfully.  Since an item can have multiple transactions, asin the case of a Dutch Auction, you need to group them together to get all thetransactions for an Item.  To get a list of the items that ended but werenot sold, use GetSellerList and look for items with QuantitySold zero.

Here is an example using SDK 3.0.  It contains pieces of  the code behind a windows formGetEndedItems with two ListView Controls.  lvSold displays the items thatended and sold successfully.  lvItemsNotSold displays the items that endedand did not sell.  The UI also contains two DateTimePicker controls to letthe user select the dates range for which they want all the transactions anditems that ended.  

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Configuration;
using eBay.Service.Call;
using eBay.Service.Util;
using eBay.Service.Core.Sdk;
using eBay.Service.Core.Soap;

namespace SDK3
{
   ///<summary>
   ///Summary description for GetEndedItems. 
   ///</summary> 

    public classGetEndedItems : System.Windows.Forms.Form
    {
        //my variables 
        ApiContext context; 

       private voidGetEndedItems_Load(objectsender, System.EventArgs e)
        {
            //set the context 
            context = newApiContext();            

            //set the logging 
            string logFile =ConfigurationSettings.AppSettings["LogFile"];
            context.ApiLogManager = newApiLogManager();
            context.ApiLogManager.ApiLoggerList.Add(newFileLogger(logFile, true, true,true));
            context.ApiLogManager.EnableLogging = true;

             //set the version 
            context.Version = "413";
        }

         public ApiContextGetContext()
        {
           // Credentials for the call
            context.ApiCredential.eBayToken =ConfigurationSettings.AppSettings["Token"];
            context.SoapApiServerUrl = ConfigurationSettings.AppSettings["URL"];
             return context;
        }

         private voidbtnGetEndedItems_Click(objectsender, System.EventArgs e)
        {
             bool blnHasMore = true

            //GET THE SUCCESSFUL ITEMS
           int pageNumber =1; 
            GetSellerTransactionsCall getSellerTransactions = newGetSellerTransactionsCall(GetContext());
            getSellerTransactions.DetailLevelList.Add(DetailLevelCodeType.ReturnAll);

             //Pagination
            getSellerTransactions.Pagination = newPaginationType();
            getSellerTransactions.Pagination.EntriesPerPage = 200;

             //Time filter 
            getSellerTransactions.ModTimeFilter = newTimeFilter(dtpFrom.Value, dtpTo.Value);

           while(blnHasMore)
            {
                //Set the page number 
               getSellerTransactions.Pagination.PageNumber = pageNumber;

                //Make the call 
               TransactionTypeCollection sellerList =getSellerTransactions.GetSellerTransactions(dtpFrom.Value, dtpTo.Value);              

               foreach(TransactionTypetransaction insellerList)
               { 
                   string[] output = new string[5]; 

                   output[0] = transaction.Item.ItemID; 
                   output[1] = transaction.Item.Title; 
                   output[2] = transaction.Buyer.UserID; 
                   output[3] = transaction.QuantityPurchased.ToString(); 
                   output[4] = transaction.AmountPaid.ToString();
                   lvSold.Items.Add(newListViewItem(output));
                }

                 if (!getSellerTransactions.ApiResponse.HasMoreTransactions)
                   blnHasMore = false;
                else 
                   pageNumber++; 
            } 
            //Sort the ListView to group all the transactions with the same ItemID together. 
            //Sorting is done by ItemID since it is the first Column in the ListViewControl

           lvSold.Sort();

            //GET THE UNSUCCESSFUL ITEMS 
            GetSellerListCall getSellerList = newGetSellerListCall(GetContext()); 
           getSellerList.DetailLevelList.Add(DetailLevelCodeType.ReturnAll);

           //Pagination 
            getSellerList.Pagination = newPaginationType(); 
            getSellerList.Pagination.EntriesPerPage = 200; 
            pageNumber = 1;

           //End Time filter 
            getSellerList.EndTimeFilter = newTimeFilter(dtpFrom.Value, dtpTo.Value); 
            blnHasMore = true

            while(blnHasMore) 
            {
                //Set the page number 
               getSellerList.Pagination.PageNumber = pageNumber;              

                 //Make the call 
               ItemTypeCollection sellerList = getSellerList.GetSellerList();
               foreach (ItemTypeitem in sellerList) 
               {
                   string[] output = new string[4]; 
                   output[0] = item.ItemID; 
                   output[1] = item.Title; 
                   output[2] = item.SellingStatus.CurrentPrice.Value.ToString(); 
                   output[3] = item.SellingStatus.BidCount.ToString();

                   //Get the unsuccessful items 
                   if (item.SellingStatus.QuantitySold== 0) 
                   lvItemsNotSold.Items.Add(newListViewItem(output)); 
               }

                if(!getSellerList.ApiResponse.HasMoreItems) 
                   blnHasMore = false
                 else 
                   pageNumber++; 
            } 
        } 
    } 
}

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