借助计划,您可以控制商品的 推广,并增强 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}"
}