The code for this API sample can be found in the grades.js file. This example shows how to make a call to the classlist in order to fetch all the users and then asynchronously gather each user's final grade.
In order to fetch the Final Grades for a specific course, two API calls are used:
- Classlist API
/d2l/api/le/(version)/(orgUnitId)/classlist/
- Final Grades API
/d2l/api/le/(version)/(orgUnitId)/grades/final/values/(userId)
The example provided exposes a route for accessing the Final Grade information for a given course. The course is determined from the orgUnitId
query parameter passed into this route. The index page has this value hardcoded and it can be changed. Please read Configurations for more information on making this change.
The route provided is /finalgrades
- This route takes the result from the classlist and combines each user object with the object received from calling the final grades route resulting in a list of users and their final grade.
- The route can be accessed using OAuth 2.0 Authentication or the ID/Key authentication.
- To asynchronously call the final grades route for each user in the classlist the Node async library was used.