Programs 子 API 概览

借助计划,您可以控制商品的宣传,并在各种 Google 平台上增强账号的功能。

一个典型的例子就是非付费商品详情计划,借助该计划,您网店中的商品可在 Google 各平台上免费展示。

借助 Programs 子 API,您可以检索和更新自己参与的所有可用购物计划。

如需检索、启用和停用计划,您可以使用以下方法:

列出所有计划

如需检索账号的所有计划,请使用 accounts.programs.list 方法。

以下是请求示例:

HTTP

GET https://merchantapi.googleapis.com/accounts/v1beta/accounts/{ACCOUNT_ID}/programs

cURL

  curl \
  'https://merchantapi.googleapis.com/accounts/v1beta/accounts/{ACCOUNT_ID}/programs?key=[YOUR_API_KEY]' \
  --header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
  --header 'Accept: application/json' \
  --compressed

以下是成功请求的示例响应:

{
  "programs": [
    {
      "name": "accounts/{ACCOUNT_ID}/programs/free-listings",
      "documentationUri": "{URI}",
      "state": "{ACCOUNT_STATE}",
      "unmetRequirements": [
        {
          "title": "{TITLE}",
          "documentationUri": "{URI}",
          "affectedRegionCodes": [
            "{REGION_CODE}"
          ]
        }
      ]
    }
  ]
}

检索单个节目

如需检索特定节目,请使用 accounts.programs.get 方法。

以下是请求示例:

HTTP

GET https://merchantapi.googleapis.com/accounts/v1beta/accounts/{ACCOUNT_ID}/programs/free-listings

cURL

  curl \
  'https://merchantapi.googleapis.com/accounts/v1beta/accounts/{ACCOUNT_ID}/programs/free-listing?key=[YOUR_API_KEY]' \
  --header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
  --header 'Accept: application/json' \
  --compressed

以下是成功请求的示例响应:

{
  "name": "accounts/{ACCOUNT_ID}/programs/free-listings",
  "documentationUri": "{URI}",
  "state": "{ACCOUNT_STATE}",
  "unmetRequirements": [
    {
      "title": "{TITLE}",
      "documentationUri": "{URI}",
      "affectedRegionCodes": [
        "{REGION_CODE}"
      ]
    }
  ]
}

启用计划

如需为账号启用参与指定计划的功能,请使用 accounts.programs.enable 方法。您必须拥有管理员访问权限才能运行此权限。

以下是请求示例:

HTTP

POST https://merchantapi.googleapis.com/accounts/v1beta/accounts/{ACCOUNT_ID}/programs/free-listings:enable

cURL

  curl --request POST \
  'https://merchantapi.googleapis.com/accounts/v1beta/accounts/{ACCOUNT_ID}/programs/free-listing:enable?key=[YOUR_API_KEY]' \
  --header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{}' \
  --compressed

以下是成功请求的示例响应:

{
  "name": "accounts/{ACCOUNT_ID}/programs/free-listings",
  "documentationUri": "{URI}",
  "state": "{ACCOUNT_STATE}",
  "unmetRequirements": [
    {
      "title": "{TITLE}",
      "documentationUri": "{URI}",
      "affectedRegionCodes": [
        "{REGION_CODE}"
      ]
    }
  ]
}

停用计划

如需为账号停用参与指定计划的功能,请使用 accounts.programs.disable 方法。您必须拥有管理员访问权限才能运行此权限。

以下是请求示例:

HTTP

POST https://merchantapi.googleapis.com/accounts/v1beta/accounts/{ACCOUNT_ID}/programs/free-listings:disable

cURL

  curl --request POST \
  'https://merchantapi.googleapis.com/accounts/v1beta/accounts/{ACCOUNT_ID}/programs/free-listing:disable?key=[YOUR_API_KEY]' \
  --header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{}' \
  --compressed

以下是成功请求的示例响应:

{
  "name": "accounts/{ACCOUNT_ID}/programs/free-listings",
  "documentationUri": "{URI}",
  "state": "{ACCOUNT_STATE}"
}