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

โปรแกรมช่วยให้คุณควบคุมการโปรโมตผลิตภัณฑ์และปรับปรุงฟีเจอร์ของบัญชีในแพลตฟอร์มต่างๆ ของ Google ได้

ตัวอย่างที่พบได้ทั่วไปของกรณีนี้คือโปรแกรมข้อมูลผลิตภัณฑ์ที่แสดงฟรี ซึ่งช่วยให้ผลิตภัณฑ์จากร้านค้าออนไลน์ของคุณแสดงใน Google ได้โดยไม่เสียค่าใช้จ่าย

API ย่อยของโปรแกรมช่วยให้คุณเรียกข้อมูลและอัปเดตการเข้าร่วมโปรแกรม Shopping ที่พร้อมใช้งานทั้งหมดได้

หากต้องการเรียกดู เปิดใช้ และปิดใช้โปรแกรม คุณสามารถใช้วิธีการต่อไปนี้

แสดงรายการโปรแกรมทั้งหมด

หากต้องการเรียกข้อมูลโปรแกรมทั้งหมดของบัญชี ให้ใช้เมธอด accounts.programs.list

ตัวอย่างคําขอมีดังนี้

HTTP

GET https://merchantapi.googleapis.com/accounts/v1beta/accounts/{ACCOUNT_ID}/programs

cURL

  curl \
  'https://merchantapi.googleapis.com/accounts/v1beta/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/v1beta/accounts/{ACCOUNT_ID}/programs/free-listings

cURL

  curl \
  'https://merchantapi.googleapis.com/accounts/v1beta/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/v1beta/accounts/{ACCOUNT_ID}/programs/free-listings:enable

cURL

  curl --request POST \
  'https://merchantapi.googleapis.com/accounts/v1beta/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/v1beta/accounts/{ACCOUNT_ID}/programs/free-listings:disable

cURL

  curl --request POST \
  'https://merchantapi.googleapis.com/accounts/v1beta/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}"
}