每页ebay api条目

时间:2017-11-24 19:46:36

标签: c# vb.net ebay

通过以下代码,我得到的卖家数量每页最多200个。

我读了Ebay API Reference,最多可以返回5000条记录。我唯一需要的是设置

  

DetailLevelCodeType

只返回我需要的数据。在具体情况下指定我只需要返回 item.Title和Item.Quantity,Item.SellingStatus.CurrentPrice.Value

我应该将检索更改为5000条记录?

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

1 个答案:

答案 0 :(得分:0)

其中一个解决方案是首次阅读所有项目而不提供详细信息。并且对于每个项目再次运行api调用以检查它的信息。

  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