Home
Find the answer to your question
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
{
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();
// 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;
}