ภาพรวมของ Programs Sub-API

โปรแกรมช่วยให้คุณควบคุมการโปรโมตผลิตภัณฑ์และปรับปรุงฟีเจอร์ของบัญชีในแพลตฟอร์มต่างๆ ของ 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}"
}