The Final Grades sample is quite similar to the The Basic Sample. It builds upon that sample to demonstrate how to make a series of Brightspace API calls and do some processing to accomplish a task that joins data together from several sources.
The sample assumes the calling user context is an instructor (and that in all course offering enrollments, the calling user is enrolled in an instructor role).
It uses the get my enrollments route to retrieve all the course offerings in which the calling user is enrolled. It then gets all the students enrolled in those course offerings with the get enrolled users for orgunit route. Finally, it retrieves all the final grades for all those enrolled students using the get final grades for user in orgunit route.
This sample shows you:
- How to chain several calls together and aggregate the data to accomplish your own needs.
- How to deal with getting data sent to you in a paged result set.
Walk-through
This sample provides new functionality built on a framework very similar to the Basic Sample: through a simple-web form, you can authenticate and then wait a moment to retrieve and process all the students' final grade values for the calling instructor user.
- Click the Authenticate button.
- The form redirects your browser to the D2L login page hosted on http://lms.valence.desire2learn.com.
- Fill out your test user name and password for the service (authenticating yourself as a user), and click Login.
- The service redirects you back to your sample web-form.
- The form makes the calls and processing required to show you the aggregated final grade values for your calling user's courses.
Install and Run the Sample
Python
This sample for the Python platform has the same requirements as the Python client library. You will also require the Bottle and Beaker Python packages, as the sample is implemented as a simple web services application in a Bottle framework using Beaker to manage session state data.
- Download the latest version of the General Python sample repository and unzip the contents into a temporary folder.
- Run the finalGrades.py script within the appropriate sub-directory in the samples folder to start the Bottle web-service application.
- In a web-browser, navigate to http://localhost:8080/start.
Note: For additional samples from the General Python sample repository, see the Profile Change Sample and The Basic Sample