プログラムを使用すると、さまざまな Google サービスで商品の プロモーションを管理し、 アカウントの機能を強化できます。
その典型的な例が無料商品リスティングプログラムです。このプログラムを利用すると、オンライン ショップの商品を Google 全体に無料で表示できます。
プログラム サブ 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}"
}