Search code examples
c#vb.netebay-api

ebay api entries per page


Using the code bellow I get the amount of my sellers list MAX 200 per page.

I read Ebay API Reference that it is possible to have up to 5000 records returned. The only it says I need to do is to set the DetailLevelCodeType to return me only data I need. In my specific case to specify I only need to return item.Title and Item.Quantity, Item.SellingStatus.CurrentPrice.Value

What should I change the retrieve up to 5000 records?

Try
            Dim ApicallItem As GetItemCall = New GetItemCall(Context)

            Dim apicall As GetSellerListCall = New GetSellerListCall(Context)

            apicall.DetailLevelList.Add(DetailLevelCodeType.ReturnAll)

            apicall.Pagination = New PaginationType()

            apicall.Pagination.PageNumber = 1

            'apicall.Pagination.EntriesPerPage = 200

            apicall.UserID = myCfg.EbayUserId

            Dim dateValue As DateTime = DateTime.Now
            Dim d As DateTime = DateTime.Now.AddDays(-90)

            apicall.StartTimeFilter = New TimeFilter(d.Date + New TimeSpan(0, 0, 0), dateValue.Date + New TimeSpan(23, 59, 59))

            Dim sellerlist As ItemTypeCollection = apicall.GetSellerList()
            Dim item As ItemType

            For Each item In sellerlist
                If item.Quantity <> 0 Then
                    ' DO MY CODE
                End If
            Next item

        Catch ex As Exception
            WriteLog("Error while getting sellers list: " & ex.Message)
        End Try

Solution

  • One of the solutions is to first time read all items without details. And the for each of those item run again api call to check info of it.

      For Each Items In sellerlist
                    Dim ApiOneItem As GetItemCall = New GetItemCall(Context)
                    ApiOneItem.DetailLevelList.Add(DetailLevelCodeType.ReturnAll)
    
                    Item = ApicallItem.GetItem(Items.ItemID)
                    If Item.Quantity <> 0 Then
                    End if
      Next