Hiện tại, các nhà phát triển đã có thể sử dụng rộng rãi tiện ích bổ sung của Google Lớp học! Vui lòng xem tài liệu về tiện ích bổ sung để biết thêm thông tin.
Người dùng được chỉ định trong ownerId là chủ sở hữu của khoá học đã tạo và được thêm làm giáo viên. Người dùng yêu cầu không phải là quản trị viên chỉ có thể tạo khoá học mà họ là chủ sở hữu. Quản trị viên miền có thể tạo khoá học thuộc sở hữu của bất kỳ người dùng nào trong miền của họ.
Phương thức này trả về các mã lỗi sau:
PERMISSION_DENIED nếu người dùng yêu cầu không được phép tạo khoá học hoặc đối với lỗi truy cập.
NOT_FOUND nếu giáo viên chính không phải là người dùng hợp lệ.
FAILED_PRECONDITION nếu tài khoản của chủ sở hữu khoá học bị vô hiệu hoá hoặc đối với các lỗi yêu cầu sau đây:
UserCannotOwnCourse
UserGroupsMembershipLimitReached
CourseTitleCannotContainUrl
ALREADY_EXISTS nếu bạn đã chỉ định một bí danh trong id và bí danh đó đã tồn tại.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-08-08 UTC."],[],[],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)."]]