我有一个关于学生对课程的反应的查询。
我没有得到API调用中的两个参数(emailAddress和photoUrl)
调用API的URL时"https://classroom.googleapis.com/v1/courses/{courseId}/学生"。
我得到以下回复:
{
"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"
}
}
}
]
}
但是,当我在谷歌课堂的开发者控制台中通过传递相同的courseId来执行它时,我得到的响应如下:
{
"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"*
}
}
]
}
Praveen-要访问emailAddress和photoURL,您需要请求以下额外的OAuth作用域:
https://www.googleapis.com/auth/classroom.profile.photos
https://www.googleapis.com/auth/classroom.profile.emails
结账https://developers.google.com/classroom/guides/auth了解更多详细信息。