获取类别中的所有项目?

时间:2013-09-04 13:45:04

标签: c# ebay-api

我只得到100个结果。代码摘录:

FindingServicePortTypeClient client = FindingServiceClientFactory.getServiceClient(config);

FindItemsByCategoryRequest req = new FindItemsByCategoryRequest();
req.categoryId = new string[] { "1249" };
req.sortOrder = SortOrderType.BestMatch;
req.sortOrderSpecified = true;
req.itemFilter = new ItemFilter[]
{
    new ItemFilter()
    {
        name = ItemFilterType.EndTimeFrom,
        value = new string[]
        {
            DateTime.Now.Add(TimeSpan.FromHours(1)).ToString("yyyy-MM-ddTHH:mm:ss")
        }
    }
};

PaginationInput pi = new PaginationInput();
pi.entriesPerPage = int.MaxValue;
pi.entriesPerPageSpecified = true;
req.paginationInput = pi;

FindItemsByCategoryResponse response = client.findItemsByCategory(req);

正如您所见,我尝试使用int.MaxValue,但无济于事。是否无法从类别中获取所有项目?

1 个答案:

答案 0 :(得分:3)

首先,eBay会将每页的分页输入条目限制为100,并且在任何特定搜索中您的总项目都会返回10,000(请参阅http://developer.ebay.com/Devzone/finding/CallRef/findItemsByCategory.html#Request.paginationInput)。因此无论合理与否,这都无法奏效。想想如果你可以在一次通话中返回超过100,000件物品的结果,他们必须处理巨大的服务器负荷。

现在,您可能认为仍然有一种聪明的方法可以超越限制区块并保持在量化限制之下。但根据http://developer.ebay.com/Devzone/finding/CallRef/findItemsByCategory.html#Request.paginationInput.pageNumber(第一个链接下方的2个条目),您甚至无法访问第100页以后的结果。因此,每页100个结果和100个页面,你真的只能获得前10,000个中的任何一个(这一点是你无法从第101页开始,因为它根本不被允许)。同样,这可能是因为他们需要通过这些资源来访问该点。这一定有点令人失望......

很抱歉:/,但这是完整的故事。

相关问题