Skip to main content
Published: September 12 2011, 9:32:00 AMUpdated: November 28 2020, 10:00:58 PM

How can I make a simple GetItemTransactions call using the .NET SDK (C#)?

Summary

GetItemTransactions C# sample



Detailed Description

This sample is using Microsoft Visual Studio 2010, eBay .NET SDK Version 715 - .NET 2.0 Point Release

Requirements:

After opening a C# project,

-  Add a reference to eBay.Service dll

-  Make sure Target Framework is not set to .NET Framework Client Profile

 

1.  Add these namespaces

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

2.  Code Sample (This sample was in a windows form project in a button click):

           

/*
© 2011-2013 eBay Inc., All Rights Reserved
Licensed under CDDL 1.0 - http://opensource.org/licenses/cddl1.php
*/

ApiContext oContext = new ApiContext();

            //set the dev,app,cert information
            oContext.ApiCredential.ApiAccount.Developer = "xxx";
            oContext.ApiCredential.ApiAccount.Application = "xxx";
            oContext.ApiCredential.ApiAccount.Certificate = "xxx";
            

            //set the AuthToken
            oContext.ApiCredential.eBayToken = "xxx";

            //set the endpoint (sandbox) use https://api.ebay.com/wsapi for production
            oContext.SoapApiServerUrl = "https://api.sandbox.ebay.com/wsapi";

            //set the Site of the Context
            oContext.Site = eBay.Service.Core.Soap.SiteCodeType.US;

            //the WSDL Version used for this SDK build
            oContext.Version = "817";

            //very important, let's setup the logging
            ApiLogManager oLogManager = new ApiLogManager();
            oLogManager.ApiLoggerList.Add(new eBay.Service.Util.FileLogger("GetItemTransactions.log", true, true, true));
            oLogManager.EnableLogging = true;
            oContext.ApiLogManager = oLogManager;

            GetItemTransactionsCall oGetItemTransactionsCall = new GetItemTransactionsCall(oContext);

            //' set the Version used in the call
            oGetItemTransactionsCall.Version = oContext.Version;

            //' set the Site of the call
            oGetItemTransactionsCall.Site = oContext.Site;

            //' enable the compression feature
            oGetItemTransactionsCall.EnableCompression = true;

            DateTime ModTimeFrom, ModTimeTo, CreateTimeFromPrev;

            //ModTimeTo set to the current time
            ModTimeTo = DateTime.Now.ToUniversalTime();

            //ts1 is 15 mins
            TimeSpan ts1 = new TimeSpan(9000000000);
            CreateTimeFromPrev = ModTimeTo.Subtract(ts1);

            //Set the ModTimeFrom the last time you made the call minus 2 minutes
            ModTimeFrom = CreateTimeFromPrev;

            //set ItemID and <DetailLevel>ReturnAll<DetailLevel>
            oGetItemTransactionsCall.ItemID = "110092045184";
            oGetItemTransactionsCall.DetailLevelList.Add(DetailLevelCodeType.ReturnAll);

            oGetItemTransactionsCall.GetItemTransactions("110092045184", ModTimeFrom, ModTimeTo);



Additional Resources

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