Jeremy JG Young
Jeremy JG Young

Reputation: 41

Creating a student with Google Apps Script & Google Classroom

GOAL: I am trying to use Google Apps Script & the Google Classroom API to generate a student for a Google Classroom class.

ERROR: Code: 404 & message: Requested entity was not found.

CODE:

Classroom.Courses.Students.create(
            {
              "userId": "[email protected]",
              "profile": {
                "name": {
                  "givenName": "Bruce",
                  "familyName": "Wayne"
                }
              }
            }, 14496468106);

THOUGHTS: I have tried many different variations replacing the course id with the a method to retrieve the code (ie. Classroom.Courses.list().courses[0].id) and the project scoped alias (ie. "p:abc123"). When I put in an incorrect courseId I receive the same error. Also, when I replace the userId with my email or the String "me" returns an error of code: 403, message: The caller does not have permission. When I replace the userId with a friend's ID there is an error message, the caller does not have permission.

This may have something to do with permissions or formatting, but I haven't been able to figure out how to get this code to work.

Thank you for your time! Jeremy

Google Classroom API Explorer

Upvotes: 4

Views: 825

Answers (1)

Alice Keeler
Alice Keeler

Reputation: 1

Please make sure that you have admin privileges to create users. If I am not on my super admin account to run my google Classroom code to create students it will not work.

Upvotes: 0

Related Questions