Google Classroom 外掛程式現已全面開放開發人員使用!詳情請參閱
外掛程式說明文件。
Method: courses.create
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
建立課程。
ownerId
中指定的使用者是所建立課程的擁有者,並會新增為老師。如果要求者不是管理員,只能建立以自己為擁有者的課程。網域管理員可以建立網域內任何使用者擁有的課程。
這個方法會傳回下列錯誤代碼:
PERMISSION_DENIED
如果要求的使用者沒有建立課程的權限,或發生存取錯誤。
NOT_FOUND
如果主要授課老師不是有效使用者。
FAILED_PRECONDITION
如果課程擁有者的帳戶已停用,或是發生下列要求錯誤:
- UserCannotOwnCourse
- UserGroupsMembershipLimitReached
- CourseTitleCannotContainUrl
ALREADY_EXISTS
(如果別名已在 id
中指定)。
HTTP 要求
POST https://classroom.googleapis.com/v1/courses
這個網址使用 gRPC 轉碼語法。
回應主體
如果成功,回應主體會包含新建立的 Course
例項。
授權範圍
需要下列 OAuth 範圍:
https://www.googleapis.com/auth/classroom.courses
詳情請參閱授權指南。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-08 (世界標準時間)。
[null,null,["上次更新時間:2025-08-08 (世界標準時間)。"],[],[],null,["# Method: courses.create\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nCreates a course.\n\nThe user specified in `ownerId` is the owner of the created course and added as a teacher. A non-admin requesting user can only create a course with themselves as the owner. Domain admins can create courses owned by any user within their domain.\n\nThis method returns the following error codes:\n\n- `PERMISSION_DENIED` if the requesting user is not permitted to create courses or for [access errors](/workspace/classroom/reference/Access.Errors).\n- `NOT_FOUND` if the primary teacher is not a valid user.\n- `FAILED_PRECONDITION` if the course owner's account is disabled or for the following [request errors](/workspace/classroom/reference/Request.Errors):\n - UserCannotOwnCourse\n - UserGroupsMembershipLimitReached\n - CourseTitleCannotContainUrl\n- `ALREADY_EXISTS` if an alias was specified in the `id` and already exists.\n\n### HTTP request\n\n`POST https://classroom.googleapis.com/v1/courses`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Request body\n\nThe request body contains an instance of [Course](/workspace/classroom/reference/rest/v1/courses#Course).\n\n### Response body\n\nIf successful, the response body contains a newly created instance of [Course](/workspace/classroom/reference/rest/v1/courses#Course).\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/classroom.courses`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent)."]]