Put Grades Error

Options
Hello,
I am trying to answer this question:
Will assigning a passing grade also show the exam as completed in Brightspace?

I am trying to put a grade with the api but I keep getting this error "Comments and PrivateComments are mandatory"

This is my payload:
{
"GradeObjectType": 1,
"PointsNumerator": 99,
"Comments": "Great job on the exam!",
"PrivateComments": "Nice"
}

Any ideas of what the problem is?

Thanks

Answers

  • Sreelakshmi.N.546
    Options

    Hi Jonathan,

    As per the documentation: https://docs.valence.desire2learn.com/res/grade.html#put--d2l-api-le-(version)-(orgUnitId)-grades-(gradeObjectId)-values-(userId)

     when providing numeric grade values, you should make a JSON block that includes both the basic common properties and numeric:


    ... https://docs.valence.desire2learn.com/res/grade.html#Grade.IncomingGradeValue

    The Comments and PrivateComments fields are expected to be in Rich Text format

    Eg:

    Data
    {
    // appropriate basic common properties here
    "Comments": {
    "Content": "Great job on the exam!" ,
    "Type": "Text|Html"
    },
    "PrivateComments": {
    "Content": "Nice" ,
    "Type": "Text|Html"
    },
    "GradeObjectType": 1,
    "PointsNumerator": 99
    }

    Can you please try sending JSON parameter for PUT call as above and see if API call is successful or not.

    Thanks,

    Sreelakshmi

  • Jonathan.A.324
    Jonathan.A.324 Posts: 3 🔍
    Options

    When I do a GET I get this:

    {    "PointsNumerator": 2.000000000,    "PointsDenominator": 100.000000000,    "WeightedNumerator": null,    "WeightedDenominator": null,    "GradeObjectIdentifier": "468",    "GradeObjectName": "Certification Exam",    "GradeObjectType": 9,    "GradeObjectTypeName": "Category",    "DisplayedGrade": "2 %",    "Comments": {        "Text": "",        "Html": ""    },    "PrivateComments": {        "Text": "",        "Html": ""    },    "LastModified": "2023-08-07T21:32:23.730Z",    "LastModifiedBy": 0,    "ReleasedDate": null}

    Then in the PUT body I use this

    {"Comments": {"Content": "Great job on the exam!" ,"Type": "Text|Html"},"PrivateComments": {"Content": "Nice" ,"Type": "Text|Html"},"GradeObjectType": 9,"PointsNumerator": 99}

    But I get a:

    {    "type": "http://docs.valence.desire2learn.com/res/apiprop.html#json-binding-error",    "title": "JSON Binding Error",    "status": 400,    "detail": "Provided JSON is invalid or does not match the expected format."}

    Please note I am using GradeObjectType = 9

    Any ideas?