le 1.22 Classlist API not providing username and email?

Akshya.Pandey5843
Akshya.Pandey5843 Posts: 7 🌱
edited November 2022 in Development

I am a developer for a 3rd party vendor that offers Attendance taking solutions to schools. As such, I make use of D2L APIs that provide me information about students in a course.

 

The API that I use to get enrollments is the classlist API (https://docs.valence.desire2learn.com/res/enroll.html#get--d2l-api-le-(version)-(orgUnitId)-classlist-)

 

However, I've found that this API wasn't giving me all of the expected information on a user.

 

In particular, I've got a sandbox course where I am making this particular API call:

https://devcop.brightspace.com/d2l/api/le/1.22/7380/classlist/

 

One of the responses I get for a student:

{"Identifier":"141865","ProfileIdentifier":"MAbWfHSD0v","DisplayName":"Stark, Anthony","Username":null,"OrgDefinedId":"astark","Email":null,"FirstName":"Anthony","LastName":"Stark","RoleId":110,"LastAccessed":"2020-06-08T19:15:11.900Z","IsOnline":false}

 

The username and email fields are null.

 

However, when I view this user profile from the admin panel, I see a username (astark) and an email (akshya@goqwickly.com).

 

Any idea why I am missing this information in the API response? Any help is appreciated!

 

Tagged:

Answers

  • Richard.M.314
    Richard.M.314 Posts: 16
    edited November 2022

    Hi,

     

    This api follows the same settings as the Classlist UI. I think you need to enable this config: d2l.Tools.Classlist.DisplayEmail = True. There is also a paged version of the classlist api. I would recommend using this one: /d2l/api/le/(version)/(orgUnitId)/classlist/paged/ [GET]

  • Akshya.Pandey5843
    Akshya.Pandey5843 Posts: 7 🌱
    edited November 2022

    Hi Richard

     

    Thank you for the response!

     

    I am not quite sure how to get to the d2l.Tools.Classlist.DisplayEmail = True configuration that you've described?

     

    Here are the options I am seeing in my sandbox course for Classlist and when I click on Classlist settings:

    classlist1

     

    classlist2

    Is it something that needs to be managed in the System Admin level? If you can point me to the right direction, I would appreciate it!!

  • Richard.M.314
    Richard.M.314 Posts: 16
    edited November 2022

    Hi Akshya,

     

    The config system is a tool that administrators typically have access to.

     

    I've enabled the display email config for your course (7380). Can you please verify the email address is returned as expected?

     

     

  • Akshya.Pandey5843
    Akshya.Pandey5843 Posts: 7 🌱
    edited November 2022

    Hi Richard

     

    Thank you for looking into this!

     

    GET https://devcop.brightspace.com/d2l/api/le/1.22/7380/classlist/ seems to be providing me with the user emails now. But it's still not returning a username field, that is still null.

     

    Would you be able to tell me the precise steps that an Administrator would need to follow to allow these mechanisms? This is an issue that has been reported to us by some our our clients who use this tool so it would be very helpful if I could forward them along the solution in detail.

     

    Thanks again!

  • Richard.M.314
    Richard.M.314 Posts: 16
    edited November 2022

    Hi Akshya,

     

    A similar config exists for the username and I've updated it for your course as well. d2l.Tools.Classlist.DisplayUsername = true. I'm sorry I missed that on the first pass.

     

    The configs for the classlist are documented here.

  • Akshya.Pandey5843
    Akshya.Pandey5843 Posts: 7 🌱
    edited November 2022

    Hi Richard

     

    Thank you!! The usernames are showing now.

     

    Thank you as well for pointing me to the documentation. The provided documentation lists the "Classlist configuration variables" but doesn't quite go over how to get to this page from the D2L Admin panel. Is there a resource that shows how to get to this control?

     

    A lot of our clients won't know their way around the administration panel and will have questions about implementation. I was hoping to provide them a step-by-step guide for getting to these controls.

     

    I do have an account with administrative access to https://devcop.brightspace.com/ so if this is a page I could get to myself, I could create this guide for my clients. I have attached an Image of the settings I am able to get to as an admin but I don't quite know how to access these controls.

     

    If you can provide any guidance on this, it would be very much appreciated.

    admin

  • Richard.M.314
    Richard.M.314 Posts: 16
    edited November 2022

    Hi Akshya,

     

    Making the update is pretty simple. There's a fair bit of documentation already available.

     

    Goto: Gears -> Config Variable Browser

    Use the search box to pull the config d2l.Tools.Classlist.DisplayUsername

    Apply desired settings

     

    I think it'll be up to Administrator to decide how to apply the change since this will change what students see in the classlist tool. Configs can be set to cascade down from the Org, department or applied to a course as I did your request.

     

    I believe the paged version of the api I mentioned above doesn't have this restriction. It may not help if you have code in production, but perhaps going forward you wouldn't need this extra step.

     

    Hope this helps.

  • Akshya.Pandey5843
    Akshya.Pandey5843 Posts: 7 🌱
    edited November 2022

    This helps a lot, Richard. I am able to get to this setting page now and I just tweaked the username back to off for my course, and confirmed that it works. Thanks.

     

    I wanted to follow your suggestion to use the paged API. I just tried running the paged API in the same course. Doing GET https://devcop.brightspace.com/d2l/api/le/1.34/7380/classlist/paged/ still shows me the enrollments without any usernames(they are all null).

     

    I already have the API (non-paged) in production so I believe it's best to move forward by providing this information to my clients about updating the allowed variables.

  • Richard.M.314
    Richard.M.314 Posts: 16
    edited November 2022

    Ah yes, I see that as well. It's probably tied to a permission/setting I'm not aware of. If you would like I can chase that down if you decide to go that direction.

     

    Take care,

  • Akshya.Pandey5843
    Akshya.Pandey5843 Posts: 7 🌱
    edited November 2022

    Thanks, Richard. You have already been of tremendous help, at least I now have a reference guide for getting the missing data points.

     

    If you are able to find why we are still missing the data points in the paged API, and if there is a preferred API version number that we haven't been using so far, I would love it if you forwarded that information to me!

     

    Take Care!

  • Richard.M.314
    Richard.M.314 Posts: 16
    edited November 2022

    Hi Aksha,

     

    I'm pretty sure the missing permission is under User Privacy Information in the Roles & Permissions tool. In addition to the config d2l.Tools.Classlist.DisplayUsername you will need the "See Username" permission enabled at the course offering level.

  • Akshya.Pandey5843
    Akshya.Pandey5843 Posts: 7 🌱
    edited November 2022

    If it appears both the paged classlist API and the basic classlist API need some system admin configuration for all data points to appear, then I think at this moment I will continue with the basic classlist API since that is already being used in production.

     

    I've created an article for our clients to enable the missing data fields in the Classlist UI with which they can get the application working right away. (https://qwickly.zendesk.com/hc/en-us/articles/360045208351-Qwickly-Attendance-LTI-for-D2L-Attendance-Tool-is-unable-to-load-certain-User-fields)