【发布时间】:2012-10-29 13:53:23
【问题描述】:
我正在使用 google 购物 api 将卖家数据作为 atom 提要获取,但有时 google atom 提要的商店少于我在使用相同搜索关键字或 ean 时可以在 google 购物网站上看到的实际商店数量代码。
可能是什么原因造成的,商店是否可以选择将其产品数据隐藏在 atom 提要中?!
【问题讨论】:
我正在使用 google 购物 api 将卖家数据作为 atom 提要获取,但有时 google atom 提要的商店少于我在使用相同搜索关键字或 ean 时可以在 google 购物网站上看到的实际商店数量代码。
可能是什么原因造成的,商店是否可以选择将其产品数据隐藏在 atom 提要中?!
【问题讨论】:
编辑:由于分页不是问题,OP 正确地指出商家可以通过 API 请求排除其结果。在Product Feed Specification 上有一个excluded_destination 参数,可以为particular destination 配置。
您很可能会遇到paging 的情况。 Google(和其他)API 通常不会在响应中返回特定查询的所有结果(想想如果您要查询返回 10,000,000 个结果的东西 - 这对您的程序来说可能会很繁重,对提供者)。
为了避免这种情况,许多 API 提供了一个参数,让您可以转到结果的“下一页”。 Shopping API 提供了这样一个参数 (nextLink),您可以将其附加到查询中以获取当前结果页面之后的结果
{
"kind": "shopping#products",
"etag": value,
"id": "tag:google.com,2010:shopping/products",
"selfLink": value,
"nextLink": value,
"previousLink": value,
"totalItems": value,
"startIndex": value,
"itemsPerPage": value,
"currentItemCount": value,
content module,
...
content module,
"items": [
product resource
]
}
在哪里nextLink = Link to the next page of products, omitted if there is no next page
【讨论】: