For full functionality of this site it is necessary to enable JavaScript.
Here are the instructions how to enable JavaScript in your web browser.

Knowledge base

Find the answer to your question

Advanced Search PView

Search terms
Search Type
Sort by

GetPromotionalSaleDetails sample in using SOAP

  • Answer ID 913
  • Published 04/23/2015 02:24 PM
  • Updated 04/23/2015 02:24 PM
  • Permalink
GetPromotionalSaleDetails sample in using SOAP


GetPromotionalSaleDetails sample implemented in using Visual Studio .NET (original version, not 2003 or 2005) using the SOAP API

Detailed Description
The attached command line sample project contains an implementation of the GetPromotionalSaleDetails API call.


Any version of Visual Studio .NET

The attached project uses the original version of Visual Studio .NET
If you have a newer version of Visual Studio .NET, you should let it automatically convert the project when prompted to do so. This will result in a project that is fully functional for the Visual Studio .NET verison that you are using.

1. Before you build this sample project, please make sure to check that the project's reference for the 499 WSDL is valid.
If needed, remove the existing web reference, and add the web reference of your choosing again.
The WSDLs for each release can be found at the following URL(s):
where you replace VERSION with the number you wish to use.

2. Before you run the sample, you will need to fill in your information in place of the "xxx" and "token" in the following lines of source code:
svc.RequesterCredentials.Credentials.DevId = "xxx"
svc.RequesterCredentials.Credentials.AppId = "xxx"
svc.RequesterCredentials.Credentials.AuthCert = "xxx"
svc.RequesterCredentials.eBayAuthToken = "token"
svc.Url = ""

Please note that the default API URL is set to Production:
svc.Url = ""

Here is the actual code file contained in the attached sample project:

        ' create and set up the service
        Dim svc As New eBayAPIInterfaceService()

        ' note the querystring has the siteid, callname, version, appname, parameters
        svc.Url = ""
        ' set the security credentials 
        svc.RequesterCredentials = New CustomSecurityHeaderType()
        svc.RequesterCredentials.Credentials = New UserIdPasswordType()
        svc.RequesterCredentials.Credentials.DevId = "xxx"
        svc.RequesterCredentials.Credentials.AppId = "xxx"
        svc.RequesterCredentials.Credentials.AuthCert = "xxx"
        svc.RequesterCredentials.eBayAuthToken = "token"

        ' create the request object
        Dim Request As GetPromotionalSaleDetailsRequestType

        ' set the DetailLevel ... this call actually does not require a DetailLevel
        ' but we will set one anyway for completeness
        Dim DetailLevelArray() As DetailLevelCodeType = New DetailLevelCodeType() {DetailLevelCodeType.ReturnAll}
        Request.DetailLevel = DetailLevelArray

        ' if we want the details of just 1 specific sale
        ' then we need to uncomment the 2 lines below
        ' and set the PromotionalSaleID
        'Request.PromotionalSaleIDSpecified = True
        'Request.PromotionalSaleID = 123

        ' set the error handling to be conservative
        Request.ErrorHandlingSpecified = True
        Request.ErrorHandling = ErrorHandlingCodeType.FailOnError

        ' set the WarningLevel to High
        Request.WarningLevelSpecified = True
        Request.WarningLevel = WarningLevelCodeType.High

        Request.ErrorLanguage = "en_US"

        ' set the Version of the call
        Request.Version = "499"

        ' create a response object for this call
        Dim Response As GetPromotionalSaleDetailsResponseType

        ' we are now ready to make the call

            ' Execute the Request
            Response = svc.GetPromotionalSaleDetails(Request)

            ' if no errors occurred that did not trigger an exception
            ' then the result of this call returns an array of PromotionalSaleType objects
            If (Response.Ack = AckCodeType.Success Or Response.Ack = AckCodeType.Warning) Then

                ' output the data for each sale
                Dim Sale As PromotionalSaleType

                If (Not Response.PromotionalSaleDetails Is Nothing) Then

                    For Each Sale In Response.PromotionalSaleDetails

                        If (True = Sale.PromotionalSaleIDSpecified) Then

                            Console.WriteLine("PromotionalSaleID is " & Sale.PromotionalSaleID.ToString())

                        End If

                        If (Not Sale.PromotionalSaleName Is Nothing) Then

                            Console.WriteLine("PromotionalSaleName is " & Sale.PromotionalSaleName)

                        End If

                        If (True = Sale.StatusSpecified) Then

                            Console.WriteLine("The Status is " & Sale.Status.ToString())

                        End If

                        If (True = Sale.PromotionalSaleStartTimeSpecified) Then

                            Console.WriteLine("The StartTime is " & Sale.PromotionalSaleStartTime.ToLongDateString() & " " & Sale.PromotionalSaleStartTime.ToLongTimeString())

                        End If

                        If (True = Sale.PromotionalSaleEndTimeSpecified) Then

                            Console.WriteLine("The EndTime is " & Sale.PromotionalSaleEndTime.ToLongDateString() & " " & Sale.PromotionalSaleEndTime.ToLongTimeString())

                        End If

                        If (True = Sale.DiscountTypeSpecified) Then

                            Console.WriteLine("The DiscountType is " & Sale.DiscountType.ToString())

                        End If

                        If (True = Sale.DiscountValueSpecified) Then

                            Console.WriteLine("The DiscountValue is " & Sale.DiscountValue.ToString())

                        End If

                        ' write out the ItemIds for this sale
                        If (Not Sale.PromotionalSaleItemIDArray Is Nothing) Then

                            Dim i As Integer

                            Console.WriteLine("The ItemIDs for this sale are:")

                            For i = 0 To Sale.PromotionalSaleItemIDArray.ItemID.Length()

                                Console.WriteLine("   " & Sale.PromotionalSaleItemIDArray.ItemID.GetValue(i))


                        End If



                End If


                ' write out the long message of the error
                Console.WriteLine("The long message is " & Response.Errors(0).LongMessage)

            End If

        Catch ex As System.Web.Services.Protocols.SoapException
            Console.WriteLine(ex.Detail.OuterXml.ToString + ".", "SOAP Error")

        Catch ex As System.Exception
            Console.WriteLine(ex.Message, "General Error")

        End Try

File Attachments

How well did this answer your question?

Answers others found helpful

Print Email This Page Delicious Digg Facebook Reddit StumbleUpon Twitter