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.
Method: invitations.create
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Tạo lời mời. Mỗi người dùng và khoá học chỉ có thể có một lời mời tại một thời điểm. Xoá và tạo lại lời mời để thực hiện thay đổi.
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 lời mời cho khoá học này hoặc do lỗi truy cập.
NOT_FOUND
nếu khoá học hoặc người dùng không tồn tại.
FAILED_PRECONDITION
:
- nếu tài khoản của người dùng được yêu cầu bị vô hiệu hoá.
- nếu người dùng đã có vai trò này hoặc một vai trò có nhiều quyền hơn.
- đối với các lỗi yêu cầu sau:
ALREADY_EXISTS
nếu đã có lời mời cho người dùng và khoá học được chỉ định.
Yêu cầu HTTP
POST https://classroom.googleapis.com/v1/invitations
URL sử dụng cú pháp Chuyển mã gRPC.
Nội dung yêu cầu
Nội dung yêu cầu chứa một bản sao của Invitation
.
Nội dung phản hồi
Nếu thành công, nội dung phản hồi sẽ chứa một thực thể Invitation
mới tạo.
Phạm vi uỷ quyền
Yêu cầu phạm vi OAuth sau:
https://www.googleapis.com/auth/classroom.rosters
Để biết thêm thông tin, hãy xem Hướng dẫn uỷ quyền.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-25 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-25 UTC."],[],[],null,["# Method: invitations.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 an invitation. Only one invitation for a user and course may exist at a time. Delete and re-create an invitation to make changes.\n\nThis method returns the following error codes:\n\n- `PERMISSION_DENIED` if the requesting user is not permitted to create invitations for this course or for [access errors](/workspace/classroom/reference/Access.Errors).\n- `NOT_FOUND` if the course or the user does not exist.\n- `FAILED_PRECONDITION`:\n - if the requested user's account is disabled.\n - if the user already has this role or a role with greater permissions.\n - for the following [request errors](/workspace/classroom/reference/Request.Errors):\n - IneligibleOwner\n- `ALREADY_EXISTS` if an invitation for the specified user and course already exists.\n\n### HTTP request\n\n`POST https://classroom.googleapis.com/v1/invitations`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Request body\n\nThe request body contains an instance of [Invitation](/workspace/classroom/reference/rest/v1/invitations#Invitation).\n\n### Response body\n\nIf successful, the response body contains a newly created instance of [Invitation](/workspace/classroom/reference/rest/v1/invitations#Invitation).\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/classroom.rosters`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent)."]]