Reputation: 51
I have a query regarding Student's Response of courses.
I am not getting two parameters in API call (emailAddress and photoUrl)
While calling the URL to the API "https://classroom.googleapis.com/v1/courses/{courseId}/students" via my code.
I am getting 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 execute it in Google Classroom's developer console by passing same courseId, I am getting response as follows:
{
"students": [
{
"courseId": "303431573",
"userId": "104377167089915657872",
"profile": {
"id": "104377167089915657872",
"name": {
"givenName": "student2",
"familyName": "User",
"fullName": "student2 User"
},
"emailAddress": "[email protected]",
"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": "[email protected]",
"photoUrl": "https://lh3.googleusercontent.com/-XdUIqdMkCWA/AAAAAAAAAAI/AAAAAAAAAAA/4252rscbv5M/photo.jpg"*
}
}
]
}
Upvotes: 5
Views: 430
Reputation: 31
Praveen - to access emailAddress and photoURL you'll need to request the following additional OAuth scopes:
https://www.googleapis.com/auth/classroom.profile.photos
https://www.googleapis.com/auth/classroom.profile.emails
Check out https://developers.google.com/classroom/guides/auth for more details.
Upvotes: 2