借助商品集合,您可以定义商品组,以便与购物图片等丰富格式搭配使用。每个合集最多可包含 100 件商品。您可以使用 Google Merchant Center 或 Content API 创建合集。
本指南介绍了如何通过 Content API 使用商品集,包括如何为可购图片创建商品集以及如何查看商品集状态的示例。
使用商品集
Content API 包含两项用于管理商品集合的服务:
collections
:用于获取、列出、插入和删除商品集合。collectionstatuses
:可让您获取和列出集合的状态,以发现集合是否存在可能导致其对目标平台(例如 Google 购物广告)无效的问题。
示例:创建购物图片合集
购物图片是一种高质量图片,用于展示一种或多种带注释的商品,并使用合集进行配置。如需使用购物图片,除了所有合集所需的字段外,您还必须为 imageLink
和 featuredProduct
字段指定值。如需详细了解必填字段,请参阅 Content API 参考文档。
如需使用购物图片,您必须创建商品合集,并使用 imageLink
字段指定包含最多 10 件商品的图片。我们建议使用方形图片(宽高比为 1:1)。
您还必须使用 featuredProduct
字段指定图片中展示的商品,包括使用 x
和 y
字段指定商品在图片中的坐标。只有在合集用于购物图片时,才需要提供这些字段。x
和 y
值必须介于 0 到 1 之间(含边界值)。
每个集合最多可包含 100 件商品。不过,对于购物图片,我们建议您为每张图片指定不超过 10 件商品的坐标,以确保图片上有足够的空间来显示商品宣传信息。作为 featuredProduct
对象一部分的 offerId
字段必须与 products
资源上的 offerId
值相匹配,该值不同于 products
资源上的 id
值。
除了购物图片必需的 imageLink
和 featuredProduct
字段之外,您还可以使用可选的 headline
字段指定合集标题。我们建议您添加标题,以便为客户提供有关合集的更多详细信息。
如需为购物图片创建新的合集,请使用以下网址和请求正文向 collections.insert
端点发出 POST
请求:
https://shoppingcontent.googleapis.com/content/v2.1/merchantId/collections
{
"id": "exampleCollection"
"language": "en",
"productCountry": "UK",
"imageLink": ["www.imageLink.example"],
"featuredProduct": [
{
"offerId": '432',
"x": 0.11,
"y": 0.99
},
{ "offerId": '433',
"x": 0.53,
"y": 0.89
}
],
"link": "www.link.example",
"mobileLink": "www.mobileLink.example",
"headline": "www.link.example",
"customLabel0": "Organize",
"customLabel1": "Your",
"customLabel2": "Bidding/Reporting",
"customLabel3": "With",
"customLabel4": "Me"
}
示例:检查集合的状态
如需了解您创建的上述集合是否存在会导致该集合无法投放广告的问题,请使用以下网址向 collectionsstatuses.get
端点发出 GET
请求,并添加您要检索其状态的集合的 id
。您不必提供请求正文。
https://shoppingcontent.googleapis.com/content/v2.1/merchantID/collectionstatuses/collection ID
集合状态响应示例
{
"id": "exampleCollection",
"creationDate": "2020-09-22T00:26:51Z",
"lastUpdateDate": "2020-09-22T00:26:51Z",
"collectionLevelIssues": [
{
"code": "invalid_url",
"servability": "unaffected",
"resolution": "merchant_action",
"attributeName": "link",
"description": "Invalid URL [link]",
"detail": "Use a complete URL that starts with http:// or https:// and
links to a valid destination such as an image or a landing page",
"documentation": "https://support.google.com/merchants/answer/7052112"
},
{
"code": "invalid_url",
"servability": "unaffected",
"resolution": "merchant_action",
"attributeName": "imageLink",
"description": "Invalid URL [imageLink]",
"detail": "Use a complete URL that starts with http:// or https:// and
links to a valid destination such as an image or a landing page",
"documentation": "https://support.google.com/merchants/answer/7052112"
}
]
}