เปิดใช้ Google Workspace API

ก่อนใช้ Google APIs คุณต้องเปิดใช้ในโปรเจ็กต์ Google Cloud คุณเปิด API อย่างน้อย 1 รายการในโปรเจ็กต์ Google Cloud รายการเดียวได้ หากยังไม่มีโปรเจ็กต์ Google Cloud โปรดดูหัวข้อสร้างโปรเจ็กต์ Cloud

วิธีเปิดใช้ API ในโปรเจ็กต์ที่อยู่ในระบบคลาวด์

คอนโซล Google Cloud

  1. ในคอนโซล Google Cloud ให้ไปที่เมนู > APIs & Services > Library > Google Workspace

    ไปที่ไลบรารี API

  2. คลิก API ที่ต้องการเปิดใช้
  3. คลิกเปิดใช้
  4. หากต้องการเปิดใช้ API เพิ่มเติม ให้ทำตามขั้นตอนเหล่านี้ซ้ำ

Google Cloud CLI

  1. ติดตั้งหรือเปิดอินเทอร์เฟซบรรทัดคำสั่ง (CLI) ของ Google Cloud
  2. เรียกใช้คำสั่ง services enable โดยระบุบริการ API ที่จะเปิดใช้

    gcloud services enable API_SERVICE_ID

API ที่เปิดใช้ล่วงหน้าใน Google AI Studio

เมื่อสร้างเว็บแอปใน Google AI Studio คุณไม่จำเป็นต้องเปิดใช้ Google Workspace API ที่รองรับในคอนโซล Google Cloud ด้วยตนเอง API ต่อไปนี้จะเปิดใช้ล่วงหน้าในโปรเจ็กต์ระดับเริ่มต้นที่ Google จัดการ

  • Google Calendar API (calendar-json.googleapis.com)
  • Google Docs API (docs.googleapis.com)
  • Google Drive API (drive.googleapis.com)
  • Google Forms API (forms.googleapis.com)
  • Gmail API (gmail.googleapis.com)
  • Google Picker API (picker.googleapis.com)
  • Google Sheets API (sheets.googleapis.com)
  • Google Slides API (slides.googleapis.com)
  • Google Tasks API (tasks.googleapis.com)

ในโปรเจ็กต์ระดับเริ่มต้น Google Workspace API จะรองรับ OAuth 2.0 ฝั่งไคลเอ็นต์เท่านั้น ตัวอย่างเช่น Google Picker API ใช้โทเค็นเพื่อการเข้าถึง OAuth 2.0 แทนคีย์ API ของนักพัฒนาซอฟต์แวร์ และไม่รองรับบัญชีบริการหรือการจัดเก็บรหัสลับไคลเอ็นต์ OAuth ใน Secret Manager หากต้องการข้อมูลเข้าสู่ระบบฝั่งเซิร์ฟเวอร์, คีย์ API หรือ API เพิ่มเติม เช่น Admin SDK API หรือ Google Apps Script API คุณสามารถอัปเกรดโปรเจ็กต์ระดับเริ่มต้นเป็นโปรเจ็กต์ที่อยู่ในระบบคลาวด์มาตรฐานและกำหนดค่าด้วยตนเองได้

ดูรายละเอียดเกี่ยวกับโควต้าและฟีเจอร์ของระดับเริ่มต้นได้ที่ภาพรวมของระดับเริ่มต้นและติดตั้งใช้งานเว็บแอปจาก Google AI Studio

(ไม่บังคับ) ลองใช้ Google Workspace API ในแอปทดลอง

หากคุณกำลังทดลองใช้ Google Workspace ให้ใช้ทางลัดต่อไปนี้ ซึ่งจะเปิดใช้ Google Workspace API ยอดนิยม และสร้างข้อมูลเข้าสู่ระบบ OAuth ที่คุณใช้ได้

หากคุณกำลังพัฒนาแอปที่เข้าถึงข้อมูลผู้ใช้ คุณต้องกำหนดค่าหน้าจอขอความยินยอม OAuth ก่อนเผยแพร่แอป

คลิกปุ่มนี้เพื่อเลือกหรือสร้างโปรเจ็กต์ที่อยู่ในระบบคลาวด์ของ Google และเปิดใช้ Workspace API โดยอัตโนมัติ

เปิดใช้ Workspace API

ในกล่องโต้ตอบที่ปรากฏขึ้น ให้คลิกดาวน์โหลดการกำหนดค่าไคลเอ็นต์ แล้วบันทึก credentials.json ลงในไดเรกทอรีที่ใช้งานอยู่

ดูโปรแกรมสำรวจ Google Workspace API เพื่อดูรายการ API ทั้งหมดที่พร้อมใช้งาน และลองใช้วิธีการที่เฉพาะเจาะจงจากเบราว์เซอร์ของคุณ

API ที่เปิดใช้ (คลิกเพื่อขยาย)

ปุ่มนี้จะเปิดใช้ API ต่อไปนี้

  • Admin SDK API
  • Apps Script API
  • Calendar API
  • Chat API
  • Classroom API
  • Docs API
  • API ไดรฟ์
  • Forms API
  • Gmail API
  • API ส่วนเสริมของ Google Workspace
  • Google Keep API
  • Meet REST API
  • Sheets API
  • Slides API

Google Workspace API

ใช้ลิงก์คอนโซล Google Cloud ต่อไปนี้หรืออินเทอร์เฟซบรรทัดคำสั่ง (CLI) ของ Google Cloud เพื่อเปิดใช้ Google Workspace API ที่เฉพาะเจาะจงในโปรเจ็กต์ที่อยู่ในระบบคลาวด์

เปิดใช้ Admin SDK API
gcloud services enable admin.googleapis.com
เปิดใช้ Alert Center API
gcloud services enable alertcenter.googleapis.com
เปิดใช้ Apps Script API
gcloud services enable script.googleapis.com
เปิดใช้ CalDAV API
gcloud services enable caldav.googleapis.com
เปิดใช้ Calendar API
gcloud services enable calendar-json.googleapis.com
เปิดใช้ Chat API
gcloud services enable chat.googleapis.com
เปิดใช้ Classroom API
gcloud services enable classroom.googleapis.com
เปิดใช้ Cloud Identity API
gcloud services enable cloudidentity.googleapis.com
เปิดใช้ Cloud Search API
gcloud services enable cloudsearch.googleapis.com
เปิดใช้ Docs API
gcloud services enable docs.googleapis.com
เปิดใช้ Drive API
gcloud services enable drive.googleapis.com
เปิดใช้ Drive Activity API
gcloud services enable driveactivity.googleapis.com
เปิดใช้ Drive Labels API
gcloud services enable drivelabels.googleapis.com
เปิดใช้ Forms API
gcloud services enable forms.googleapis.com
เปิดใช้ Gmail API
gcloud services enable gmail.googleapis.com
เปิดใช้ Groups Migration API
gcloud services enable groupsmigration.googleapis.com
เปิดใช้ Groups Settings API
gcloud services enable groupssettings.googleapis.com
เปิดใช้ API ส่วนเสริมของ Google Workspace
gcloud services enable gsuiteaddons.googleapis.com
เปิดใช้ Google Keep API
gcloud services enable keep.googleapis.com
เปิดใช้ Enterprise License Manager API
gcloud services enable licensing.googleapis.com
เปิดใช้ Marketplace API
gcloud services enable appsmarket.googleapis.com
เปิดใช้ Marketplace SDK
gcloud services enable appsmarket-component.googleapis.com
เปิดใช้ Meet REST API
gcloud services enable meet.googleapis.com
เปิดใช้ People API
gcloud services enable people.googleapis.com
เปิดใช้ Postmaster Tools API
gcloud services enable gmailpostmastertools.googleapis.com
เปิดใช้ Reseller API
gcloud services enable reseller.googleapis.com
เปิดใช้ Sheets API
gcloud services enable sheets.googleapis.com
เปิดใช้ Slides API
gcloud services enable slides.googleapis.com
เปิดใช้ Tasks API
gcloud services enable tasks.googleapis.com
เปิดใช้ Vault API
gcloud services enable vault.googleapis.com

ขั้นตอนถัดไป

ดูวิธีการทำงานของการตรวจสอบสิทธิ์และการให้สิทธิ์สำหรับ Google Workspace API