Google Classroom 外掛程式現已全面開放開發人員使用!詳情請參閱
外掛程式說明文件。
Google Apps Script 快速入門導覽課程
快速入門說明如何設定及執行呼叫 Google Workspace API 的應用程式。
Google Workspace 快速入門會使用 API 用戶端程式庫處理驗證和授權流程的部分細節。建議您為自家應用程式使用用戶端程式庫。本快速入門導覽課程會使用簡化的驗證方法,適合測試環境使用。如要使用正式環境,建議您先瞭解驗證和授權,再選擇適合應用程式的存取憑證。
建立用於向 Google Classroom API 提出要求的 Google Apps Script。
目標
必要條件
- 已啟用 Google Classroom 的 Google for Education 帳戶。
建立指令碼
- 前往 script.google.com/create 建立新指令碼。
- 使用下列程式碼取代指令碼編輯器的內容:
- 按一下「儲存」圖示
。
- 按一下「無標題的專案」,輸入「Quickstart」,然後點選「Rename」。
啟用 Google Classroom API
- 開啟 Apps Script 專案。
- 按一下「編輯器」圖示 code。
- 按一下「服務」旁的「新增服務」圖示 add。
- 選取 Google Classroom API,然後按一下「新增」。
執行範例
在 Apps Script 編輯器中,按一下「Run」。
第一次執行範例時,系統會提示您授權存取權:
- 按一下「查看權限」。
- 選擇所需帳戶。
- 按一下「允許」。
指令碼的執行記錄會顯示在視窗底部。
後續步驟
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-12-21 (世界標準時間)。
[null,null,["上次更新時間:2024-12-21 (世界標準時間)。"],[[["This quickstart guide demonstrates how to create a Google Apps Script that interacts with the Google Classroom API to list courses."],["Before running the script, you need a Google for Education account, access to Google Drive, and must enable the Google Classroom API within the script."],["The script retrieves and displays the names and IDs of up to 10 courses from your Google Classroom account, requiring authorization upon its first execution."],["For production environments, refer to the provided resources for authentication, authorization, and troubleshooting guidance."],["Users can explore further by consulting the advanced services documentation, troubleshooting guide, and the Classroom API reference."]]],[]]