Updating grades with Postman

Matias.C.1931
Matias.C.1931 Posts: 4 🔍
Hello team! Actually Im trying to update some grades using APIs in this endpoint:

https://udlatest.brightspace.com/d2l/api/le/1.25/{my_orgUnitID}/grades/{grade_item_id}/values/{student/user_id}

When I make a Get request, i have this output:

{
"PointsNumerator": 9.000000000,
"PointsDenominator": 10.000000000,
"WeightedNumerator": 54.000000000,
"WeightedDenominator": 60.000000000,
"GradeObjectIdentifier": "368978",
"GradeObjectName": "Cuestionario de prueba",
"GradeObjectType": 1,
"GradeObjectTypeName": "Numérico",
"DisplayedGrade": "90%",
"Comments": {
"Text": "",
"Html": ""
},
"PrivateComments": {
"Text": "",
"Html": ""
},
"LastModified": "2024-07-04T18:22:36.197Z",
"LastModifiedBy": 35415,
"ReleasedDate": null
}

How can I make a put request to update this grade? Because when I try to make it with this boy in json and setting Content-Type: application/json in headers, i got a 400 bad request:

{
"PointsNumerator": 5.0,
"PointsDenominator": 10.0,
"Comments": null,
"PrivateComments": null,
"Feedback": {
"Text": null,
"Html": null
}
}

Hope you can help me, thanks!
Tagged:

Answers

  • Andrea.M.553
    Andrea.M.553 Posts: 87

    Hello,

    For PUT /d2l/api/le/(version)/(orgUnitId)/grades/(gradeObjectId)/values/(userId)

    The body should be:

    {
        "Comments": {
            "Content": "Words go here",
            "Type": "Text"
    },
        "PrivateComments": {
            "Content": "Words go here",
            "Type": "Text"
    },
        "GradeObjectType": 1, // This is for numeric
        "PointsNumerator": {{points}} // The number of points
    }
    

    Let me know if this works for you.

    Best,

    Andrea

  • Matias.C.1931
    Matias.C.1931 Posts: 4 🔍

    Hello Andrea, thank you so much for your message!
    It works!


    Have a nice day,

    Matías

  • Andrea.M.553
    Andrea.M.553 Posts: 87

    Wonderful! I am so glad it worked out!