Create Grade Object - API Grade.GradeObject

Options

Hello,

I'm trying to use this request "/d2l/api/le/1.61/{ORGUNITID}/grades/" to create a new grade object using this JSON:


{   "MaxPoints": 100,

   "CanExceedMaxPoints": false,

   "IsBonus": false,

   "ExcludeFromFinalGradeCalculation": false,

   "GradeSchemeId": null,

   "Name": "Task1",

   "ShortName": "Tsk1",

   "GradeType": "Numeric",

   "CategoryId": 0,

   "Description": {

       "Html": "<p>Test.</p>",

       "Text": "Test"

   },

   "AssociatedTool": null,

   "IsHidden": false

}

However, I'm getting the following error:


{

    "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."

}


I've already read the information, changed values, and tried many things, but nothing seems to be working. Does anyone have experience with this and can offer some help?


Thanks,

Answers

  • Bill.C.651
    Options

    Hello,

    You are so close; all you need is one simple change:
    "Description": {
    "Html": "<p>Test.</p>",
    "Text": "Test"
    },

    To:
    "Description": {
    "Content": "<p>Test.</p>",
    "Type": "Html"
    },

    The third bullet in the restrictions note explains it:
    The Description field should use the RichTextInput field type, and not the RichText type sent back on output by the service.

    Refer to RichTextInput:
    https://docs.valence.desire2learn.com/basic/conventions.html#term-RichTextInput


    I've been caught by this one myself many times ;)
    Good luck,