Search code examples
hyperlinkgoogle-apigoogle-classroom

Google Classroom API create a link to the course


I am developing an agenda for my students. They are enrolled in different classes and have different courses in Google Classroom.

I am able to get the Classroom courses id, and get the grades. But I can not find information about how to link from my agenda to the course. Can I use the course id to create a link to the classroom course?

For example, if I get the courses list like this:

12012929120
12129399390
10101303003

Is there anyway to create a URL to go directly to that course? (For example: https://classroom.google.com/id/12012929120)

Or is any other way to retrieve my courses from the API and create links to my courses?


Solution

  • From the document, upon creating a classroom using Method: courses.create if the creation is successful the return value of this method is the classroom resource object which includes the alternateLink:

    {
      "id": string,
      "name": string,
      "section": string,
      "descriptionHeading": string,
      "description": string,
      "room": string,
      "ownerId": string,
      "creationTime": string,
      "updateTime": string,
      "enrollmentCode": string,
      "courseState": enum(CourseState),
      "alternateLink": string,
      "teacherGroupEmail": string,
      "courseGroupEmail": string,
      "teacherFolder": {
        object(DriveFolder)
      },
      "courseMaterialSets": [
        {
          object(CourseMaterialSet)
        }
      ],
      "guardiansEnabled": boolean,
    }
    

    You can use the alternateLink to pass as a hyperlink for your classroom.

    Hope this helps.