透過計畫,您可以控管產品的宣傳活動,並在各項 Google 平台上提升帳戶功能。
這類服務的典型例子是免費產品資訊計畫,可讓你免費在 Google 各平台上顯示網路商店的產品。
透過 Programs 子 API,你可以擷取並更新參與所有可用的購物計畫。
如要擷取、啟用及停用程式,您可以使用下列方法:
列出所有節目
如要擷取帳戶的所有節目,請使用 accounts.programs.list 方法。
以下是要求範例:
HTTP
GET https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/programs
cURL
  curl \
  'https://merchantapi.googleapis.com/accounts/v1/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/v1/accounts/{ACCOUNT_ID}/programs/free-listings
cURL
  curl \
  'https://merchantapi.googleapis.com/accounts/v1/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/v1/accounts/{ACCOUNT_ID}/programs/free-listings:enable
cURL
  curl --request POST \
  'https://merchantapi.googleapis.com/accounts/v1/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/v1/accounts/{ACCOUNT_ID}/programs/free-listings:disable
cURL
  curl --request POST \
  'https://merchantapi.googleapis.com/accounts/v1/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}"
}