ก่อนใช้ Google APIs คุณต้องเปิดใช้ในโปรเจ็กต์ Google Cloud คุณเปิด API อย่างน้อย 1 รายการในโปรเจ็กต์ Google Cloud รายการเดียวได้ หากยังไม่มีโปรเจ็กต์ Google Cloud โปรดดูหัวข้อสร้างโปรเจ็กต์ Cloud
วิธีเปิดใช้ API ในโปรเจ็กต์ที่อยู่ในระบบคลาวด์
คอนโซล Google Cloud
- ในคอนโซล Google Cloud ให้ไปที่เมนู > APIs & Services > Library > Google Workspace
- คลิก API ที่ต้องการเปิดใช้
- คลิกเปิดใช้
- หากต้องการเปิดใช้ API เพิ่มเติม ให้ทำตามขั้นตอนเหล่านี้ซ้ำ
Google Cloud CLI
- ติดตั้งหรือเปิดอินเทอร์เฟซบรรทัดคำสั่ง (CLI) ของ Google Cloud
-
เรียกใช้คำสั่ง
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 โดยอัตโนมัติ
ในกล่องโต้ตอบที่ปรากฏขึ้น ให้คลิกดาวน์โหลดการกำหนดค่าไคลเอ็นต์ แล้วบันทึก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 |
เปิดใช้ Admin SDK API
|
Alert Center API |
เปิดใช้ Alert Center API
|
Apps Script API |
เปิดใช้ Apps Script API
|
CalDAV API |
เปิดใช้ CalDAV API
|
Calendar API |
เปิดใช้ Calendar API
|
Chat API |
เปิดใช้ Chat API
|
Classroom API |
เปิดใช้ Classroom API
|
Cloud Identity API |
เปิดใช้ Cloud Identity API
|
Cloud Search API |
เปิดใช้ Cloud Search API
|
Docs API |
เปิดใช้ Docs API
|
Drive API |
เปิดใช้ Drive API
|
Drive Activity API |
เปิดใช้ Drive Activity API
|
Drive Labels API |
เปิดใช้ Drive Labels API
|
Forms API |
เปิดใช้ Forms API
|
Gmail API |
เปิดใช้ Gmail API
|
Groups Migration API |
เปิดใช้ Groups Migration API
|
Groups Settings API |
เปิดใช้ Groups Settings API
|
API ส่วนเสริมของ Google Workspace |
เปิดใช้ API ส่วนเสริมของ Google Workspace
|
Google Keep API |
เปิดใช้ Google Keep API
|
Enterprise License Manager API |
เปิดใช้ Enterprise License Manager API
|
Marketplace API |
เปิดใช้ Marketplace API
|
Marketplace SDK |
เปิดใช้ Marketplace SDK
|
Meet REST API |
เปิดใช้ Meet REST API
|
People API |
เปิดใช้ People API
|
Postmaster Tools API |
เปิดใช้ Postmaster Tools API
|
Reseller API |
เปิดใช้ Reseller API
|
Sheets API |
เปิดใช้ Sheets API
|
Slides API |
เปิดใช้ Slides API
|
Tasks API |
เปิดใช้ Tasks API
|
Vault API |
เปิดใช้ Vault API
|
ขั้นตอนถัดไป
ดูวิธีการทำงานของการตรวจสอบสิทธิ์และการให้สิทธิ์สำหรับ Google Workspace API