Google 课堂插件现已面向开发者正式推出!如需了解详情,请参阅
插件文档。
Method: courses.create
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
创建课程。
ownerId
中指定的用户是所创建课程的所有者,并已添加为教师。非管理员请求用户只能创建以自己为所有者的课程。网域管理员可以创建由其网域中的任何用户拥有的课程。
此方法会返回以下错误代码:
PERMISSION_DENIED
如果请求用户无权创建课程,或出现访问错误。
NOT_FOUND
如果主讲教师不是有效用户。
FAILED_PRECONDITION
如果课程所有者的账号被停用,或者出现以下请求错误:
- UserCannotOwnCourse
- UserGroupsMembershipLimitReached
- CourseTitleCannotContainUrl
- 如果别名已在
id
中指定且已存在,则为 ALREADY_EXISTS
。
HTTP 请求
POST https://classroom.googleapis.com/v1/courses
网址采用 gRPC 转码语法。
响应正文
如果成功,响应正文将包含一个新创建的 Course
实例。
授权范围
需要以下 OAuth 范围:
https://www.googleapis.com/auth/classroom.courses
如需了解详情,请参阅授权指南。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-08。
[null,null,["最后更新时间 (UTC):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)."]]