An Invitation
resource in Classroom represents an invitation
for a user to join a course with a specific course role: student, teacher,
or owner.
Each Invitation
resource contains the following fields:
id
: Classroom-assigned identifier for the invitation.userId
: The ID of the user that has been invited to the course.courseId
: The course that the user is being invited to.role
: The course role that the invited user will have in the course.
Create an Invitation
The invitations.create()
method can be used to invite a user to a course
with a specific role. Include the Invitation
resource in the request body
and specify the courseId
, userId
, and role
.
Java
Retrieve an Invitation
Retrieve a specific invitation by calling the invitations.get()
method
and specifying the id
of the invitation.
Java
Accept an Invitation
Accepting an invitation deletes the invitation and adds the invited
user to the course with the role specified in the invitation. Accept an
invitation by calling the invitations.accept()
method and specifying the
id
of the invitation.
Java
Delete an Invitation
The only way to update an invitation is to delete it and create a new
invitation. To delete the invitation, call the invitations.delete()
method
and specify the id
.