Search code examples
restgoogle-classroom

How to convert enrollment code to course id?


Is there a way to get a course identifier (id, course object itself .etc) from an enrollment code with an HTTP request?

I don't see any way to do so in the classroom REST API documentation.

Similar to scripting a join screen, how do I convert an enrollment code obtained from a GoogleTeacher to a classroom id which I can then use with an API call like GET https://classroom.googleapis.com/v1/courses/id (Classroom.Courses.get())?


Solution

  • there might be no direct way to query courses by the enrollmentCode - but one can list all courses to get their courseIds and then use get by courseId, in order to compare the enrollmentCode of that course and return the room, when the enrollmentCode matches.

    see the API documentation.