โปรแกรมช่วยให้คุณควบคุมการ โปรโมตผลิตภัณฑ์และปรับปรุง ฟีเจอร์ของบัญชีใน Surfaces across Google ต่างๆ ได้
ตัวอย่างทั่วไปคือโปรแกรมข้อมูลผลิตภัณฑ์ที่แสดงฟรี ซึ่งช่วยให้ผลิตภัณฑ์จากร้านค้าออนไลน์ของคุณปรากฏใน Google ได้โดยไม่เสียค่าใช้จ่าย
โปรแกรม sub-API ช่วยให้คุณดึงข้อมูลและอัปเดตการเข้าร่วมโปรแกรม Shopping ที่มีทั้งหมดได้
หากต้องการดึงข้อมูล เปิดใช้ และปิดใช้โปรแกรม คุณสามารถใช้วิธีการต่อไปนี้
แสดงรายการโปรแกรมทั้งหมด
หากต้องการดึงข้อมูลโปรแกรมทั้งหมดสำหรับบัญชี ให้ใช้
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}"
}