Product Statuses API

Product Statuses API 的目的是识别和收集有关商品问题的信息。默认情况下,API 仅返回有关您的有效商品的信息。要接收商品的全部详情,请将 includeInvalidInsertedItems 标志设置为 true。我们建议您定期调用 includeInvalidInsertedItems API 以发现商品的问题。

get

productstatuses.get 方法检索一种商品的数据质量状态。

GET https://www.googleapis.com/content/v2/{merchantID}/productstatuses/{productId}?destinations=Shopping&includeAttributes=true&fields=productId%2Ctitle

以下是 productstatuses.get 方法的可选网址参数:

{merchantID}
商家 ID。
{productID}
商品 ID。要查看商品 ID 示例,请参阅商品 ID 指南中的 REST ID 属性。
destinations
以英文逗号分隔的平台列表。默认值是 Shopping,其对应于购物广告计划。
includeAttributes
要在响应中包含完整商品数据的标志。默认值为 false

以下是从 productstatuses.get 调用得到的 JSON 响应示例:

{
"kind": "content#productStatus",
"productId": "online:en:US:63",
"title": "Third Product",
"link": "http://examplemenc.com/",
"destinationStatuses": [
 {
  "destination": "ShoppingActions",
  "intention": "required",
  "approvalStatus": "disapproved",
  "approvalPending": false
 },
 {
  "destination": "SurfacesAcrossGoogle",
  "intention": "required",
  "approvalStatus": "disapproved",
  "approvalPending": false
 }
],
"itemLevelIssues": [
 {
  "code": "strong_id_inaccurate",
  "servability": "disapproved",
  "resolution": "merchant_action",
  "attributeName": "mpn",
  "destination": "Shopping",
  "description": "Incorrect product identifier [mpn]",
  "detail": "Use the manufacturer's product identifiers (GTIN, brand, MPN)",
  "documentation": "https://support.google.com/merchants/answer/160161"
 },
 {
  "code": "image_link_internal_error",
  "servability": "disapproved",
  "resolution": "merchant_action",
  "attributeName": "image link",
  "destination": "Shopping",
  "description": "Processing failed [image link]",
  "detail": "Wait for the product image to be crawled again (up to 3 days)",
  "documentation": "https://support.google.com/merchants/answer/6240184"
 },
 {
  "code": "landing_page_error",
  "servability": "disapproved",
  "resolution": "merchant_action",
  "attributeName": "link",
  "destination": "Shopping",
  "description": "Unavailable desktop landing page",
  "detail": "Update your website or landing page URL to enable access from desktop devices",
  "documentation": "https://support.google.com/merchants/answer/6098155"
 },
 {
  "code": "missing_condition_microdata",
  "servability": "unaffected",
  "resolution": "merchant_action",
  "destination": "Shopping",
  "description": "Missing or invalid data [condition]",
  "detail": "Add valid structured data markup to your landing page",
  "documentation": "https://support.google.com/merchants/answer/6183460"
 },
 {
  "code": "mobile_landing_page_error",
  "servability": "disapproved",
  "resolution": "merchant_action",
  "attributeName": "link",
  "destination": "Shopping",
  "description": "Unavailable mobile landing page",
  "detail": "Update your website or landing page URL to enable access from mobile devices",
  "documentation": "https://support.google.com/merchants/answer/6098296"
 }
],
"creationDate": "2019-02-15T20:30:15Z",
"lastUpdateDate": "2019-02-26T16:40:11Z",
"googleExpirationDate": "2019-03-28T16:40:11Z"
}

资源

get 调用返回的 JSON 主体包含多个部分。所有商品都返回了基本信息和平台状态,但是只有存在问题的商品才会返回商品级问题。基本信息是一系列单独的属性,但其他部分是属性段,因为商品可能存在多个问题。

基本信息

kind
kind 的值始终是 content#productStatus,用来表示 productstatuses 调用的主体。
creationDate
创建商品的日期。
lastUpdateDate
最后一次更新商品的时间。
googleExpirationDate
商品过期的日期。
productId
商品的 REST ID。
title
商品的名称。
link
商品的网址链接。

平台状态

destination
平台,如下所示:
  • 购物广告
  • Shopping Actions
  • Surfaces Across Google
  • 购物
intention
平台的目的,可以是以下选项之一:
  • 默认
  • 已排除
  • 可选
  • 必需
approvalStatus
状态可以是以下选项之一:
  • 已批准
  • 未获批准
approvalPending
布尔值,表示尚未确定批准状态。

商品级问题

code
用于确定问题的错误代码。
servability
指示商品是否显示为以下选项之一:
  • 未获批准,表示该问题会阻止商品展示。
  • 不受影响,表示数据质量问题不会阻止商品在商场上展示。
resolution
通知商家是否可以解决问题。
attributeName
受影响的属性名称。
destination
受影响的平台。
description
商品的说明。
detail
提供有关该问题的详情。
documentation
告知可以找到问题文档的位置。

list

productstatuses.list 方法检索有问题的商品列表。

GET https://www.googleapis.com/content/v2/{merchantID}/productstatuses?destinations=Shopping&includeAttributes=false&includeInvalidInsertedItems=true&maxResults=3&pageToken=5108b52782905aa9

以下是 productstatuses.list 方法的可选参数:

destinations

平台,在这种情况下为 Shopping。基本网址是

https://www.googleapis.com/content/v2
{merchantID}

替换为您的商家 ID。

pageToken

用于取得第二页和后续页面。每个页面都有一个 nextPageToken,您将其传回以取得序列中的下一页。

destinations

以英文逗号分隔的平台列表。默认值为 Shopping

includeAttributes

要在响应中包含完整商品数据的标志。默认值为 false

includeInvalidInsertedItems

包含已插入的无效商品的标志(如果值为 true)。默认值为 false

maxResults

每页返回的结果数。

以下是来自 productstatuses.get 调用的 JSON 响应示例(请注意,productstatuses.list 中返回的资源格式与单件商品 GET API 调用的格式类似):

{
"kind": "content#productstatusesListResponse",
"nextPageToken": "632fd090c95712c6",
"resources": [
 {
  "kind": "content#productStatus",
  "productId": "online:en:US:20",
  "title": "twenty Product",
  "link": "http://examplemenc.com/",
  "destinationStatuses": [
   {
    "destination": "ShoppingActions",
    "intention": "required",
    "approvalStatus": "disapproved",
    "approvalPending": false
   },
   {
    "destination": "SurfacesAcrossGoogle",
    "intention": "required",
    "approvalStatus": "disapproved",
    "approvalPending": false
   }
  ],
  "creationDate": "2019-01-14T18:23:04Z",
  "lastUpdateDate": "2019-02-08T22:28:16Z",
  "googleExpirationDate": "2019-03-10T22:28:16Z"
 },
 {
  "kind": "content#productStatus",
  "productId": "online:en:US:43",
  "title": "Green shirt",
  "link": "https://example.com/shirt-green/",
  "destinationStatuses": [
   {
    "destination": "ShoppingActions",
    "intention": "required",
    "approvalStatus": "approved",
    "approvalPending": false
   },
   {
    "destination": "SurfacesAcrossGoogle",
    "intention": "required",
    "approvalStatus": "approved",
    "approvalPending": false
   }
  ],
  "creationDate": "2019-01-29T21:14:36Z",
  "lastUpdateDate": "2019-02-21T18:47:44Z",
  "googleExpirationDate": "2019-03-23T18:47:44Z"
 },
 {
  "kind": "content#productStatus",
  "productId": "online:en:US:40",
  "title": "Black hat",
  "link": "https://example.com/hat-black/",
  "destinationStatuses": [
   {
    "destination": "ShoppingActions",
    "intention": "required",
    "approvalStatus": "disapproved",
    "approvalPending": false
   },
   {
    "destination": "SurfacesAcrossGoogle",
    "intention": "required",
    "approvalStatus": "approved",
    "approvalPending": false
   }
  ],
  "creationDate": "2019-01-29T21:14:36Z",
  "lastUpdateDate": "2019-02-21T18:47:44Z",
  "googleExpirationDate": "2019-03-23T18:47:44Z"
 }
]
}

测试 productstatuses.list API

在生产环境中测试 productstatuses.list API 应该是非常安全的,因为它不做任何更改,而只是报告状态。

V2 到 V2.1 的变化

  • product 属性以及 includeAttributes 参数已被移除。要检索与状态对应的商品属性,请使用 Products 服务和新的 productId 字段的值。

  • 参数 includeInvalidInsertedItems 已被移除。无论商品是否有效,现在都会返回每件商品的 productId

  • destinationStatuses 中的字段 intentionapprovalStatusapprovalPending 已替换为 status,其为一个字符串,可以是以下值之一:approveddisapprovedpending

  • dataQualityIssues 已替换为 itemLevelIssues

有关 V2.1 中所做更改的详情,请参阅从 V2 迁移到 V2.1