Google Classroom Adapter Actions
  • 03 Jun 2022
  • 6 Minutes to read
  • Dark
    Light

Google Classroom Adapter Actions

  • Dark
    Light

Article summary

G-Suite Adapter Actions

The Google Classroom Adapter depends on the Google Apps Adapter and requires it to be licensed. Google Classroom actions require a connection created with defineGoogleAppsOAuthConnection(). The OAuth Credential used must have the classroom related scopes enabled, which are not selected by default. 

addGoogleClassroomCourseAlias

Add an Alias to a Google Classroom Course.

Property

Value

Description

connection*

expression, variable

the Google Apps connection definition

courseId*

text, expression, variable

the id of the Course

alias*

text, expression, variable

the Alias to add

returnVariable

expression, variable

name of the variable to be assigned to the return value

# add a domain scoped alias to the course
newAlias = addGoogleClassroomCourseAlias(conn, courseId,
"d:English101Section2")

addGoogleClassroomCourseStudent

Add a Google Apps User to a Google Classroom Course as a Student.

Property

Value

Description

connection*

expression, variable

the Google Apps connection definition

courseId*

text, expression, variable

the id of the Course

userId*

text, expression, variable

the id of the Student to add to the Course

returnVariable

expression, variable

name of the variable to be assigned to the return value

# add a student to course
newStudent = addGoogleClassroomCourseStudent(conn,
"d:English101Section2", "john.doe@example.com")

addGoogleClassroomCourseStudents

Add a batch of Google Apps Users to a Google Classroom Course as Students.

Property

Value

Description

connection*

expression, variable

the Google Apps connection definition

courseId*

text, expression, variable

the id of the Course

userIds*

text, expression, variable

array of ids to add to the Course

returnVariable

expression, variable

name of the variable to be assigned to the return value

# add students to course
newStudents = addGoogleClassroomCourseStudents(conn,
"d:English101Section2", ["john.doe@example.com",
"jane.doe@example.com"])

addGoogleClassroomCourseTeacher

Add a Google Apps User to a Google Classroom Course as a Teacher.

Property

Value

Description

connection*

expression, variable

the Google Apps connection definition

courseId*

text, expression, variable

the id of the Course

userId*

text, expression, variable

the id of the Teacher to add to the Course

returnVariable

expression, variable

name of the variable to be assigned to the return value

# add a teacher to course
newTeacher = addGoogleClassroomCourseTeacher(conn,
"d:English101Section2", "juan.fulano@example.com")

addGoogleClassroomCourseTeachers

Add a batch of Google Apps Users to a Google Classroom Course as Teachers.

Property

Value

Description

connection*

expression, variable

the Google Apps connection definition

courseId*

text, expression, variable

the id of the Course

userIds*

text, expression, variable

array of ids to add to the Course

returnVariable

expression, variable

name of the variable to be assigned to the return value

# add teachers to course
newStudents = addGoogleClassroomCourseTeachers(conn,
"d:English101Section2", ["juan.fulano@example.com",
"maria.fulano@example.com"])

deleteGoogleClassroomCourse

Delete a Google Classroom Course record by Id.

Property

Value

Description

connection*

expression, variable

the Google Apps connection definition

id*

text, expression, variable

the id of the Course to delete

returnVariable

expression, variable

name of the variable to be assigned to the return value

# delete a course
deleted = deleteGoogleClassroomCourse(conn,
"d:English101Section2")

deleteGoogleClassroomCourseAlias

Delete an Alias from a Google Classroom Course.

Property

Value

Description

connection*

expression, variable

the Google Apps connection definition

courseId*

text, expression, variable

the id of the Course

alias*

text, expression, variable

the Alias to delete

returnVariable

expression, variable

name of the variable to be assigned to the return value

# delete the alias from the course
deleted = deleteGoogleClassroomCourse(conn, courseId,
"d:English101Section2")

deleteGoogleClassroomCourseInvitation

Delete an Invitation to a Google Classroom Course.

Property

Value

Description

connection*

expression, variable

the Google Apps connection definition

id*

text, expression, variable

the id of the Invitation

returnVariable

expression, variable

name of the variable to be assigned to the return value

# get the invitation so we can find its id
invitation = getGoogleClassroomCourseInvitations(conn,
{courseId: courseId, userId: "juan.fulano@example.com"})
# delete the invitation
deleted = deleteGoogleClassroomCourseInvitation(conn, invitation.id)

deleteGoogleClassroomCourseInvitations

Delete a batch of Invitations to Google Classroom Courses.

Property

Value

Description

connection*

expression, variable

the Google Apps connection definition

ids*

text, expression, variable

array of ids to delete

returnVariable

expression, variable

name of the variable to be assigned to the return value

# get all invitations to a course
invitations = getGoogleClassroomCourseInvitations(conn,
{courseId: courseId})
# extract the ids
invitationIds = createArray()
forEach(invitation, invitations) {
appendArrayElement(invitationIds, invitation.id)
}
deleted = deleteGoogleClassroomCourseInvitations(conn,
invitationIds)

deleteGoogleClassroomCourses

Delete a batch of Google Classroom Course record by Id.

Property

Value

Description

connection*

expression, variable

the Google Apps connection definition

ids*

text, expression, variable

array of the Google Classroom User ids to delete

returnVariable

expression, variable

name of the variable to be assigned to the return value

# delete courses
deleted = deleteGoogleClassroomCourses(conn, [course1Id, course2Id])

deleteGoogleClassroomCourseStudent

Delete a Student from a Google Classroom Course.

Property

Value

Description

connection*

expression, variable

the Google Apps connection definition

courseId*

text, expression, variable

the id of the Course

userId*

text, expression, variable

the id of the Student to delete from the Course

returnVariable

expression, variable

name of the variable to be assigned to the return value

# remove a student from course
deleted = deleteGoogleClassroomCourseStudent(conn, courseId,
"john.doe@example.com")

deleteGoogleClassroomCourseStudents

Delete a batch of Students from a Google Classroom Course.

Property

Value

Description

connection*

expression, variable

the Google Apps connection definition

courseId*

text, expression, variable

the id of the Course

userIds*

text, expression, variable

array of ids to remove from the Course

returnVariable

expression, variable

name of the variable to be assigned to the return value

# remove students from course
deleted = deleteGoogleClassroomCourseStudents(conn, courseId,
["john.doe@example.com", "jane.doe@example.com"])

deleteGoogleClassroomCourseTeacher

Delete a Teacher from a Google Classroom Course.

Property

Value

Description

connection*

expression, variable

the Google Apps connection definition

courseId*

text, expression, variable

the id of the Course

userId*

text, expression, variable

the id of the Teacher to delete from the Course

returnVariable

expression, variable

name of the variable to be assigned to the return value

# remove a teacher from course
deleted = deleteGoogleClassroomCourseTeacher(conn, courseId,
"juan.fulano@example.com")

deleteGoogleClassroomCourseTeachers

Delete a batch of Teachers from a Google Classroom Course.

Property

Value

Description

connection*

expression, variable

the Google Apps connection definition

courseId*

text, expression, variable

the id of the Course

userIds*

text, expression, variable

array of ids to remove from the Course

returnVariable

expression, variable

name of the variable to be assigned to the return value

# remove teachers from course
deleted = deleteGoogleClassroomCourseTeachers(conn, courseId,
["juan.fulano@example.com", "maria.fulano@example.com"])

getGoogleClassroomCourse

Get a Google Classroom Course record by Id.

Property

Value

Description

connection*

expression, variable

the Google Apps connection definition

id*

text, expression, variable

the id of the Course to get

returnVariable

expression, variable

name of the variable to be assigned to the return value

# get a course
course = getGoogleClassroomCourse(conn, courseId, English101Section2")

getGoogleClassroomCourseAliases

Get the aliases for a Google Classroom Course.

Property

Value

Description

connection*

expression, variable

the Google Apps connection definition

courseId*

text, expression, variable

the id of the Course

returnVariable

expression, variable

name of the variable to be assigned to the return value

# get the aliases for a course
aliases = getGoogleClassroomCourseAliases(conn, courseId)

getGoogleClassroomCourseInvitations

Get list of outstanding Google Classroom Course Invitations.

Property

Value

Description

connection*

expression, variable

the Google Apps connection definition

filter*

text, expression, variable

filter to limit the Invitations returned (default: none)

returnVariable

expression, variable

name of the variable to be assigned to the return value

# get the outstanding invitations for a course
invitations = getGoogleClassroomCourseInvitations(conn, {courseId:
courseId})

getGoogleClassroomCourses

Get Google Classroom Course records.

Property

Value

Description

connection*

expression, variable

the Google Apps connection definition

filter

text, expression, variable

filter to limit the Courses returned (default: none)

returnVariable

expression, variable

name of the variable to be assigned to the return value

# get the courses that a student is enrolled in
courses = getGoogleClassroomCourses(conn,
{studentId: "john.doe@example.com"})

getGoogleClassroomCoursesById

Get batch of Google Classroom Course records by Id.

Property

Value

Description

connection*

expression, variable

the Google Apps connection definition

ids*

text, expression, variable

array of the Google Classroom User ids to get

returnVariable

expression, variable

name of the variable to be assigned to the return value

# get the courses by id
courses = getGoogleClassroomCoursesByID(conn, [course1Id, course2Id])

getGoogleClassroomCourseStudents

Get the list of Students from a Google Classroom Course.

Property

Value

Description

connection*

expression, variable

the Google Apps connection definition

courseId*

text, expression, variable

the id of the Course

returnVariable

expression, variable

name of the variable to be assigned to the return value

# get the students from a course
students = getGoogleClassroomCourseStudents(conn, courseId)

getGoogleClassroomCourseTeachers

Get the list of Teachers from a Google Classroom Course.

Property

Value

Description

connection*

expression, variable

the Google Apps connection definition

courseId*

text, expression, variable

the id of the Course

returnVariable

expression, variable

name of the variable to be assigned to the return value

# get the students from a course
teacher = getGoogleClassroomCourseTeachers(conn, courseId)

inviteUsersToGoogleClassroomCourse

Invite a batch of Google Apps Users to a Google Classroom Course.

Property

Value

Description

connection*

expression, variable

the Google Apps connection definition

courseId*

text, expression, variable

the id of the Course

userIds*

text, expression, variable

array of ids to invite to the Course

role*

choice (STUDENT, TEACHER), text, expression, variable

the role of the invited Users

returnVariable

expression, variable

name of the variable to be assigned to the return value

# invite students to a course
invitations = inviteUsersToGoogleClassroomCourse(conn, courseId,
["john.doe@example.com", "jane.doe@example.com"], "STUDENT")

inviteUserToGoogleClassroomCourse

Invite a Google Apps User to a Google Classroom Course.

Property

Value

Description

connection*

expression, variable

the Google Apps connection definition

courseId*

text, expression, variable

the id of the Course

userId*

text, expression, variable

the id of the User to invite to the Course

role*

choice (STUDENT, TEACHER), text, expression, variable

the role of the invited User

returnVariable

expression, variable

name of the variable to be assigned to the return value

# invite a teacher to a course
invitations = inviteUserToGoogleClassroomCourse(conn, courseId,
"maria.fulano.doe@example.com"], "TEACHER")

openGoogleClassroomCourseIterator

Open Google Classroom Course Iterator.

Property

Value

Description

connection*

expression, variable

the Google Apps connection definition

filter

text, expression, variable

filter to limit the Courses returned (default: none)

returnVariable

expression, variable

name of the variable to be assigned to the return value

# iterate all the courses in the domain
courses = openGoogleClassroomCourseIterator(conn)
forEach(course, courses) {
# do something
}

saveGoogleClassroomCourse

Property

Value

Description

connection*

expression, variable

the Google Apps connection definition

record*

expression, variable

the record to save

returnVariable

expression, variable

name of the variable to be assigned to the return value

# create a new course
courseTemplate = createRecord()
setRecordFieldValue(courseTemplate, "name", "English 101");
setRecordFieldValue(courseTemplate, "section", "A");
setRecordFieldValue(courseTemplate, "descriptionHeading",
"Welcome to English 101");
setRecordFieldValue(courseTemplate, "description", "Remedial English");
setRecordFieldValue(courseTemplate, "room", "222", false);
setRecordFieldValue(courseTemplate, "ownerId", "admin@example.com");
setRecordFieldValue(courseTemplate, "courseState", "ACCEPTED");
setRecordFieldValue(courseTemplate, "alias", "English-101-Section-A");
newCourse = saveGoogleClassroomCourse(conn, courseTemplate);

saveGoogleClassroomCourses

Create/Update a batch of Google Classroom Course records.

Property

Value

Description

connection*

expression, variable

the Google Apps connection definition

records*

expression, variable

array of records to save

array of records to save

expression, variable

name of the variable to be assigned to the return value

# create 3 sections of new course
courseTemplates = createArray()
forEach(section, ["A", "B", "C"])
courseTemplate = createRecord()
setRecordFieldValue(courseTemplate, "name", "English 101")
setRecordFieldValue(courseTemplate, "section", section)
setRecordFieldValue(courseTemplate, "descriptionHeading",
"Welcome to English 101")
setRecordFieldValue(courseTemplate, "description", "Remedial English")
setRecordFieldValue(courseTemplate, "room", "222", false)
setRecordFieldValue(courseTemplate, "ownerId", "admin@example.com")
setRecordFieldValue(courseTemplate, "courseState", "ACCEPTED")
setRecordFieldValue(courseTemplate, "alias", "English-101-Section-"
+ section)
appendArrayElement(courseTemplates, courseTemplate)
}
newCourse = saveGoogleClassroomCourses(conn, courseTemplates)

Was this article helpful?

ESC

Eddy AI, facilitating knowledge discovery through conversational intelligence