The third sample is quite similar to the first Basic sample. It builds upon that sample to demonstrate how to make a series of Valence Learning Framework 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
get enrolled users for orgunit
route. Finally, it retrieves all the final grades for all those enrolled
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 first 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. Deploy the sample appropriate for the platform you want, and run it, and use it in the same fashion you did for the first sample:
Click the Authenticate button.
The form redirects your browser to the D2L login page hosted on
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.
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.
To install. First download the latest version of the Python sample. Then, unzip the contents into a temporary folder.
To run the sample. Run the
finalGrades.py script within the
appropriate sub-directory in the samples folder to start the Bottle web-service
application. Then, in a web-browser, navigate to