Test Users and Roles
Good evening, I have 2 questions:
- The API Test Tool site ( ) states that you can use the DevCoPStudent account to test API calls to the test D2L site (devcop.brightspace.com). I am doing this successfully. Are there any other test accounts I can use to call the API, particularly a user that is a lecturer, not a student; and
- My application requires that I be able to identify whether the authenticated user is a Student or Lecturer. How do I do this with the API? How do I identify the role of an authenticated user? Most of the API calls on the DevCoPStudent account returns Forbidden, which complicates my investigation further. I have read through the API docs around 354 times, but cannot find a possible solution.
Thank you, Riaan.
Answers
-
I think this has been lost in the move to the new Community, the used to be in a box on the sidebar of the old Developer group on the old Community. I can't see them on the new equivalent group, but somebody there is asking the same question.
-
Thanks, although it unfortunately does not answer the questions. Any solutions would be appreciated.
-
Did yall ever figure out a way to get if a user is a Lecturer or Student?
-
Hi Riaan & Luke
Thank you for reaching out to us through the community!
Here are the answers to your queries raised.
Question 1 :
The API Test Tool site (
) states that you can use the DevCoPStudent account to test API calls to the test D2L site (devcop.brightspace.com). I am doing this successfully. Are there any other test accounts I can use to call the API, particularly a user that is a lecturer, not a studentAnswer:
We are in the process of phasing out the Developer Community of Practice test instance. The environment is cluttered with a lot of historic testing data from partners and developers, and not a reliable space that we want to encourage testing and development against.
As a replacement, we encourage customers to use their test/dev/qa Brightspace environments to perform development testing and exploration against. For partners, I'd encourage you to engage with our wonderful Partners team and they can help provide support and other resources related to building integrations with Brightspace (
The same query as yours was answered in
https://community.d2l.com/brightspace/discussion/4409/where-are-the-developer-instance-credentials-pdf-for-d2l-brightspace#latest
Question2
My application requires that I be able to identify whether the authenticated user is a Student or Lecturer. How do I do this with the API? How do I identify the role of an authenticated user?
Answer:
We don't have a single API call with which you can determine the role of the authenticated user.
Valence provides a “whoami” call that applications can use to determine the D2L ID for the user that’s currently logged in
That user ID could then maybe get passed to the enrollment API to get the role of the user in the given orgunit , say Org level or course level
Steps are as follows
- User is logged in and authenticated to the BrightSpace
- Now in API test tool, give the Host, APP ID & Key and run the authentication in the API test tool too
- Run the API " WhoAMI" to the UserID of the logged in user
- Now with the UserID received from above call, run the enrollment API : GET /d2l/api/lp/(version)/enrollments/orgUnits/(orgUnitId)/users/(userId)
Thanks
Sreelakshmi
-
Ok that's what I figured, Thanks Sreelakshmi!