获取以下 Valence Grades API 中使用的用户 ID 的首选方法是什么?
PUT /d2l/api/le/(D2LVERSION: 版本)/(D2LID: orgUnitId)/grades/(D2LID:gradeObjectId)/values/(D2LID: userId)
此处的用户 id 是否与身份验证期间收到的令牌 ID 相同,还是您调用“whoami”API,还是其他?
获取以下 Valence Grades API 中使用的用户 ID 的首选方法是什么?
PUT /d2l/api/le/(D2LVERSION: 版本)/(D2LID: orgUnitId)/grades/(D2LID:gradeObjectId)/values/(D2LID: userId)
此处的用户 id 是否与身份验证期间收到的令牌 ID 相同,还是您调用“whoami”API,还是其他?
“whoami”调用提供有关您正在使用的当前 UserContext 的数据(您在身份验证步骤中获取的令牌值)。例如,如果您以管理员身份登录,则会返回管理员的用户 ID。
GET /d2l/api/lp/(D2LVERSION: version)/users/whoami
这将为您提供有关当前 UserContext 的信息
{
"Identifier": "<string:D2LID>",
"FirstName": "<string>",
"LastName": "<string>",
"UniqueName": "<string>",
"ProfileIdentifier": "<string:D2LID>"
}
如果您正在寻找特定 orgUnit 中用户的 UserId,我会进行以下调用:
GET /d2l/api/le/(D2LVERSION: version)/(D2LID: orgUnitId)/classlist/
这将为您提供一个 ClasslistUsers 数组
{
"Identifier": "<string:D2LID>",
"ProfileIdentifier": "<string:D2LID>",
"DisplayName": "<string>",
"UserName": "<string>|null",
"OrgDefinedId": "<string>|null",
"Email": "<string>|null"
}
在任何一种情况下,“标识符”值都是您要用于 (D2LID:UserId) 的值