I was curious as to whether anyone has successfully implemented in Java the route in D2L using Valance as follows:
PUT /d2l/api/le/(D2LVERSION: version)/(D2LID: orgUnitId)/grades/(D2LID: gradeObjectId)/values/(D2LID: userId)
I have been struggling with receiving a 404 from this call when I have checked thoroughly that the required IDs match my records in D2L. When I log into D2L with the Instructor level account that I am using in Java I see that the Course, Test, and Participants are there. The IDs for these are used in the Java code to call the above route, but I receive a 404 and a grade is not updated.
Here is a snip of the code:
HttpURLConnection connection = null ;
try {
uri = userContext.createAuthenticatedUri ("/d2l/api/le/1.0/"+courseId+"/grades/"+gradeId+"/values/"+ userId, "PUT");
connection= (HttpURLConnection)uri.toURL().openConnection();
connection.setDoOutput(true);
connection.setRequestMethod("PUT");
connection.setRequestProperty("Content-Type", "application/json");
OutputStream os = connection.getOutputStream();
String updatedScore = "{\"GradeObjectType\":1,\"PointsNumerator\":\"5\"}";
os.write(updatedScore.getBytes());
os.flush();
}catch(Exception e){
e.printStackTrace();
}
The courseID, gradeID, and userID are being passed in and have been verified in the D2L Web UI. As you can see, I have a JSON string being created for a GradeObjectType of 1 and a PointsNumerator of 5. Are there special permissions that this Instructor account must have beyond the default Instructor account permissions to permit such a call?
Any thoughts would be appreciated. Thanks