Omówienie podinterfejsu API programu

Programy pozwalają kontrolować promowanie produktów i ulepszać funkcje konta na różnych platformach Google.

Typowym przykładem jest program bezpłatnych informacji o produktach, który umożliwia bezpłatne wyświetlanie produktów z Twojego sklepu internetowego w Google.

Sub-API programów umożliwia pobieranie i aktualizowanie informacji o uczestnictwie we wszystkich dostępnych programach zakupów.

Aby pobierać, włączać i wyłączać programy, możesz używać tych metod:

Wyświetlanie wszystkich programów

Aby pobrać wszystkie programy dla konta, użyj metody accounts.programs.list.

Oto przykładowa treść wiadomości:

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

Oto przykładowa odpowiedź na udane żądanie:

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

Pobieranie pojedynczego programu

Aby pobrać konkretny program, użyj metody accounts.programs.get.

Oto przykładowa treść wiadomości:

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

Oto przykładowa odpowiedź na udane żądanie:

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

Włączanie programu

Aby włączyć udział w określonym programie na koncie, użyj metody accounts.programs.enable. Aby korzystać z tego uprawnienia, musisz mieć dostęp administracyjny.

Oto przykładowa treść wiadomości:

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

Oto przykładowa odpowiedź na udane żądanie:

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

Wyłączanie programu

Aby wyłączyć udział konta w określonym programie, użyj metody accounts.programs.disable. Aby korzystać z tego uprawnienia, musisz mieć dostęp administracyjny.

Oto przykładowa treść wiadomości:

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

Oto przykładowa odpowiedź na udane żądanie:

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