Skip to main content
Published: July 18 2006, 12:40:00 PMUpdated: July 28 2022, 8:35:13 AM

How can I find out if GetSellerTransactions response has more items and if I need to increase the page number in the pagination and make the call again?

The best way to find out if GetSellerTransactions response has more items it to check the boolean tag HasMoreTransactions and see if it is true.  If it is true, you need to increase the value in your pagination and make the call again.  Repeat this till HasMoreTransactions is false.

Here is a sample code that uses the .NET SDK to iterate over the number of pages till all the transactions are retrieved:

using System;
using eBay.Service.Call;
using eBay.Service.Util;
using eBay.Service.Core.Sdk;
using eBay.Service.Core.Soap;

namespace SDK3Examples
{

public class GetTransactions
{
public string GetSellerTransactions(DateTime fromTime, DateTime toTime)
{
     bool blnHasMore = true

     int pageNumber = 1; 
     GetSellerTransactionsCall call = new GetSellerTransactionsCall(GetContext());
  
     //Pagination
     call.Pagination = new PaginationType();
     call.Pagination.EntriesPerPage = 200;

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

          //Make the call 
          TransactionTypeCollection collTrans = call.GetSellerTransactions(fromTime, toTime);              

           foreach(TransactionType transaction in collTrans)
          { 
                //process the transaction 
           }

           if (call.HasMoreTransactions)
               pageNumber++;
           else 
               blnHasMore = false
      } 
}

    public ApiContext GetContext()
    {
       ApiContext context = new ApiContext();

  // Credentials for the call
  context.ApiCredential.eBayToken = "token";

  // Set the URL
  context.SoapApiServerUrl = "https://api.sandbox.ebay.com/wsapi"; 

  // Set logging
  context.ApiLogManager = newApiLogManager();
  context.ApiLogManager.ApiLoggerList.Add(new eBay.Service.Util.FileLogger("Messages.log", true, true, true));
  context.ApiLogManager.EnableLogging = true;

  // Set the version
  context.Version = "465";

  return context;

    }

}

}

 

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