2015-10-30 9 views
5

私は、学生の反応に関する質問があります。Google Classroom API - 学生の "emailAddress"と "photoUrl"は応答に含まれていません

APIにURLを呼び出している間、私はAPIコール(EMAILADDRESSとphotoUrl)

に私のコードを経由して "https://classroom.googleapis.com/v1/courses/ {courseId} /学生を" 2つのパラメータを取得しておりません。

私は次のような応答を取得しています

{ 
    "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を渡すことで、Googleの教室のデベロッパーコンソールでそれを実行したときに、私は応答を取得しています次のように:

{ 
"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"* 
    } 
    } 
] 
} 

答えて

1

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をチェックしてください。

関連する問題