Find the answer to your question
Advanced Search
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
{
{
{
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();
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;
}
How well did this answer your question?
Answers others found helpful
- Best Practices for GetSellerEvents and GetSellerTransactions
- Incomplete or missing ShippingAddress returned in GetItemTransactions and GetSellerTransactions
- Logging API Calls with .NET SDK
- GetSellerTransactions returns same transaction for different ModTime filters
- Order management using Trading API - GetOrders