Google Classroom API - student "emailAddress" and "photoUrl" are not included in the response

I have a request regarding student responses to courses.

I do not get two parameters in the API call (emailAddress and photoUrl)

When calling the API URL " https://classroom.googleapis.com/v1/courses/ {courseId} / students" through my code.

I get the following response:

{ "students": [ { "courseId": "303431573", "userId": "104377167089915657872", "profile": { "id": "104377167089915657872", "name": { "givenName": "student2", "familyName": "User", "fullName": "student2 User" } } }, { "courseId": "303431573", "userId": "104304056850029354748", "profile": { "id": "104304056850029354748", "name": { "givenName": "student1", "familyName": "User", "fullName": "student1 User" } } } ] } 

But when I run it in the Google Classroom Developer Console, passing the same course, I get the answer as follows:

 { "students": [ { "courseId": "303431573", "userId": "104377167089915657872", "profile": { "id": "104377167089915657872", "name": { "givenName": "student2", "familyName": "User", "fullName": "student2 User" }, "emailAddress": " student2_rvnqrmpxeraft-mcygui@classroom-dev.com ", "photoUrl": "https://lh3.googleusercontent.com/-XdUIqdMkCWA/AAAAAAAAAAI/AAAAAAAAAAA/4252rscbv5M/photo.jpg" } }, { "courseId": "303431573", "userId": "104304056850029354748", "profile": { "id": "104304056850029354748", "name": { "givenName": "student1", "familyName": "User", "fullName": "student1 User" }, *"emailAddress": " student1_kb5ysml_yw4l2ecbu581@classroom-dev.com ", "photoUrl": "https://lh3.googleusercontent.com/-XdUIqdMkCWA/AAAAAAAAAAI/AAAAAAAAAAA/4252rscbv5M/photo.jpg"* } } ] } 
+5
source share
1 answer

Rights - to access emailAddress and photoURL you need to request the following additional OAuth areas:

  • https://www.googleapis.com/auth/classroom.profile.photos
  • https://www.googleapis.com/auth/classroom.profile.emails

Learn more about https://developers.google.com/classroom/guides/auth .

+1
source

Source: https://habr.com/ru/post/1234847/


All Articles