Account Statuses API

借助 Account Statuses API,您可以查看 Merchant Center 帐号或者 MCA(多客户帐号)及其所有关联子帐号的状态。

如果商家拥有多个网店或品牌,并且在不同的网站上销售商品,则商家可以选择在 MCA 下拥有子帐号。

get

借助 accountstatuses.get API 调用,一个 MCA 帐号可以获得单个子帐号的帐号状态信息,或者一个单独的帐号可以获得自己的帐号状态信息。

使用以下 API 调用可以获得帐号状态信息,其中 merchantId 是 MCA 帐号,accountId 是其子帐号。

如果 Merchant Center 帐号不是多客户帐号,accountstatuses.get 仍旧可以返回帐号状态信息;在这种情况下,对于以下 API 调用的两个参数,都请使用同一 Merchant Center 帐号。

使用 destination 参数控制 accountstatuses.get 方法可以返回哪些商品问题。未指定平台时,默认返回响应仅包含 destination: Shopping 的状态。

GET https://www.googleapis.com/content/v2/merchantId/accountstatuses/accountId

以下是对于因违反“着陆页无法访问政策”而被暂停的子帐号做出的 JSON 响应示例。

{
 "kind": "content#accountStatus",
 "accountId": "123456789",
 "websiteClaimed": true,
 "accountLevelIssues": [
  {
   "id": "editorial_and_professional_standards_destination_url_down_policy",
   "title": "Account suspended due to policy violation: landing page not working",
   "country": "US",
   "severity": "critical",
   "documentation": "https://support.google.com/merchants/answer/6150244#wycd-usefulness"
  },
  {
   "id": "missing_ad_words_link",
   "title": "No Google Ads account linked",
   "severity": "error",
   "documentation": "https://support.google.com/merchants/answer/6159060"
  }
 ],
 "products": [
  {
   "channel": "online",
   "destination": "Shopping",
   "country": "US",
   "statistics": {
    "active": "0",
    "pending": "0",
    "disapproved": "5",
    "expiring": "0"
   },
   "itemLevelIssues": [
    {
     "code": "image_link_broken",
     "servability": "disapproved",
     "resolution": "merchant_action",
     "attributeName": "image link",
     "description": "Invalid image [image link]",
     "detail": "Ensure the image is accessible and uses an accepted image format (JPEG, PNG, GIF)",
     "documentation": "https://support.google.com/merchants/answer/6098289",
     "numItems": "2"
    },
    {
     "code": "landing_page_error",
     "servability": "disapproved",
     "resolution": "merchant_action",
     "attributeName": "link",
     "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",
     "numItems": "5"
    },
    {
     "code": "missing_condition_microdata",
     "servability": "unaffected",
     "resolution": "merchant_action",
     "description": "Missing or invalid data [condition]",
     "detail": "Add valid structured data markup to your landing page",
     "documentation": "https://support.google.com/merchants/answer/6183460",
     "numItems": "5"
    },
    {
     "code": "mobile_landing_page_error",
     "servability": "disapproved",
     "resolution": "merchant_action",
     "attributeName": "link",
     "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",
     "numItems": "3"
    }
   ]
  }
 ]
}

list

accountstatuses.list API 调用返回所有子帐号的信息。使用以下 API 调用可以获得帐号状态信息,其中 merchantId 是多客户帐号的帐号。

accountstatuses.list 方法还支持按平台过滤商品问题。未指定平台时,默认返回响应仅包含 destination: Shopping 的状态。

GET https://www.googleapis.com/content/v2/merchantId/accountstatuses

以下是 JSON 响应示例:

{
 "kind": "content#accountstatusesListResponse",
 "resources": [
  {
   "kind": "content#accountStatus",
   "accountId": "1234567",
   "websiteClaimed": true,
   "accountLevelIssues": [
    {
     "id": "editorial_and_professional_standards_destination_url_down_policy",
     "title": "Account suspended due to policy violation: landing page not working",
     "country": "US",
     "severity": "critical",
     "documentation": "https://support.google.com/merchants/answer/6150244#wycd-usefulness"
    },
    {
     "id": "missing_ad_words_link",
     "title": "No Google Ads account linked",
     "severity": "error",
     "documentation": "https://support.google.com/merchants/answer/6159060"
    }
   ],
   "products": [
    {
     "channel": "online",
     "destination": "Shopping",
     "country": "US",
     "statistics": {
      "active": "0",
      "pending": "0",
      "disapproved": "0",
      "expiring": "0"
     }
    }
   ]
  },
  {
   "kind": "content#accountStatus",
   "accountId": "123456789",
   "websiteClaimed": true,
   "accountLevelIssues": [
    {
     "id": "home_page_issue",
     "title": "Website URL not provided",
     "severity": "critical",
     "documentation": "https://support.google.com/merchants/answer/176793"
    },
    {
     "id": "missing_ad_words_link",
     "title": "No Google Ads account linked",
     "severity": "error",
     "documentation": "https://support.google.com/merchants/answer/6159060"
    }
   ],
   "products": [
    {
     "channel": "online",
     "destination": "Shopping",
     "country": "US",
     "statistics": {
      "active": "0",
      "pending": "0",
      "disapproved": "0",
      "expiring": "0"
     }
    }
   ]
  }
 ]
}

对于非 MCA 帐号(例如一个独立的 Merchant Center 帐号),调用 accountstatuses.list 会返回 403 错误,其中 JSON 主体类似如下:

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "forbidden",
    "message": "111111111 is not a multi-client account (MCA). The only account
                service operations allowed on non-MCAs are 'get', 'update',
                'authinfo' and 'claimwebsite'."
   }
  ],
  "code": 403,
  "message": "111111111 is not a multi-client account (MCA). The only account
              service operations allowed on non-MCAs are 'get', 'update',
              'authinfo' and 'claimwebsite'."
 }
}

批处理模式

使用 GET 方法的 accountstatuses.custombatch 返回一个多客户帐号中多个子帐号的帐号状态信息。

请求 JSON 包括 MCA 帐号的 merchantId、子帐号的 accountId、唯一的 batchId,以及设置为 getmethod

POST https://www.googleapis.com/content/v2/accountstatuses/batch

以下是请求 JSON 主体示例:

{
  "entries": [
    {
      "accountId": 1212121212,
      "merchantId": 4444444444,
      "method": "get",
      "batchId": 9
    },
    {
      "accountId": 1313131313,
      "merchantId": 4444444444,
      "method": "get",
      "batchId": 99
    }
  ]
}

以下是 JSON 响应主体示例:

{
 "kind": "content#accountstatusesCustomBatchResponse",
 "entries": [
  {
   "batchId": 9,
   "accountStatus": {
    "kind": "content#accountStatus",
    "accountId": "1212121212",
    "websiteClaimed": true,
    "accountLevelIssues": [
     {
      "id": "home_page_issue",
      "title": "Website URL not provided",
      "severity": "critical",
      "documentation": "https://support.google.com/merchants/answer/176793"
     },
     {
      "id": "missing_ad_words_link",
      "title": "No Google Ads account linked",
      "severity": "error",
      "documentation": "https://support.google.com/merchants/answer/6159060"
     }
    ],
    "products": [
     {
      "channel": "online",
      "destination": "Shopping",
      "country": "US",
      "statistics": {
       "active": "0",
       "pending": "0",
       "disapproved": "0",
       "expiring": "0"
      }
     }
    ]
   }
  },
  {
   "batchId": 99,
   "accountStatus": {
    "kind": "content#accountStatus",
    "accountId": "1313131313",
    "websiteClaimed": true,
    "accountLevelIssues": [
     {
      "id": "editorial_and_professional_standards_destination_url_down_policy",
      "title": "Account suspended due to policy violation: landing page not working",
      "country": "US",
      "severity": "critical",
      "documentation": "https://support.google.com/merchants/answer/6150244#wycd-usefulness"
     },
     {
      "id": "missing_ad_words_link",
      "title": "No Google Ads account linked",
      "severity": "error",
      "documentation": "https://support.google.com/merchants/answer/6159060"
     }
    ],
    "products": [
     {
      "channel": "online",
      "destination": "Shopping",
      "country": "US",
      "statistics": {
       "active": "0",
       "pending": "0",
       "disapproved": "0",
       "expiring": "0"
      }
     }
    ]
   }
  }
 ]
}

从 v2 更改为 v2.1

AccountStatus 资源中,dataQualityIssues 已被 itemLevelIssues 取代。有关这些更改的更多详情,请参阅 Content API 从 v2 迁移到 v2.1

测试 accountstatuses API

这些测试示例使用 base_url 来引用 https://www.googleapis.com。此外,所有示例都在生产环境中的网址中使用 /content/v2。要测试 API v2.1,您可以改用 /content/v2.1

在以下示例中,我们可以通过 get、list 和 custombatch.get 获取并查看 MCA 帐号的帐号状态:

  1. 使用 accountstatuses.get 获取 MCA 的子帐号状态。

    1. 对 API 端点执行 GET,可以获取 merchantIdaccountId

      GET https://www.googleapis.com/content/v2/merchantId/accountstatuses/accountId
      
    2. 您应该会收到以 JSON 显示的 HTTP 200 状态代码(如果成功)和帐号状态列表。

  2. 使用 accountstatuses.list 可以查看 MCA 的所有子帐号状态。

    1. 使用您的 merchantId 对 API 端点执行 GET:

      GET https://www.googleapis.com/content/v2/merchantId/accountstatuses
      
    2. 针对已提交的 merchantId,您应该会收到以 JSON 显示的 HTTP 200 状态代码(如果成功)和帐号状态列表。

  3. 使用 accountstatuses.custombatch 以批处理模式查看 MCA 的多个子帐号。

    1. 使用您的 accountIDmerchant IDget 方法构建有效的 JSON。

    2. 对 API 端点执行 POST:

      POST https://www.googleapis.com/content/v2/accountstatuses/batch
      
    3. 您应该会收到以 JSON 显示的 HTTP 200 状态代码(如果成功)和帐号状态列表。