Skip to main content
Participant
July 9, 2018
Answered

API V2 Need sample input for userModuleGrade to get results

  • July 9, 2018
  • 1 reply
  • 592 views

I'm not sure what the "learner module grade post body" input should be for "post /users/{userId}/userModuleGrade" in the V2 version of the Captivate Prime API. I see that it requires JSON input, but not sure of the exact format and data needed.

My goal it to mark a course as complete/passed for a user. I can get the status from "get /users/{id}/enrollments/{enrollmentId}", but cannot figure out how to update it.

    This topic has been closed for replies.
    Correct answer PRO_SOL

    Below Post Body should work for the mentioned endpoint (users/{id}/userModuleGrade).
    However module id format and course id format provided in this post body follows V1 module format.
    So need to get the course and its course module info by calling v1 api first.
    This is because userModuleGrade model format conforms to v1 api format.
    courseModuleID: 208893_511761_1 , here 208893 is course_id and 511761 is module id.

    POST BODY
    ----------------------

    {
    "data": {
       "type": "userModuleGrade",
       "attributes": {
         "duration": 1,
         "score": 20,
         "minScore": 10,
         "maxScore": 20,
         "dateCompleted": "2018-07-01T04:43:37.000Z",
         "dateSuccess": "2018-07-01T04:43:37.000Z",
         "dateStarted": "2018-07-01T04:43:37.000Z",
         "started": true,
         "completed": true,
         "success": true
       },
       "relationships" : {
           "learner" : {
               "data" : [
                   {
                       "id":"123456",
                       "type": "user"
                   }
               ]
           },
           "module" : {
               "data" : [
                   {
                       "id":"208893_511761_1",
                       "type": "courseModule"
                   }
               ]
           },
           "course" : {
               "data" : [
                   {
                       "id":"208893",
                       "type": "course"
                   }
               ]
           }
       }
    }
    }

    1 reply

    PRO_SOLCorrect answer
    Participating Frequently
    July 10, 2018

    Below Post Body should work for the mentioned endpoint (users/{id}/userModuleGrade).
    However module id format and course id format provided in this post body follows V1 module format.
    So need to get the course and its course module info by calling v1 api first.
    This is because userModuleGrade model format conforms to v1 api format.
    courseModuleID: 208893_511761_1 , here 208893 is course_id and 511761 is module id.

    POST BODY
    ----------------------

    {
    "data": {
       "type": "userModuleGrade",
       "attributes": {
         "duration": 1,
         "score": 20,
         "minScore": 10,
         "maxScore": 20,
         "dateCompleted": "2018-07-01T04:43:37.000Z",
         "dateSuccess": "2018-07-01T04:43:37.000Z",
         "dateStarted": "2018-07-01T04:43:37.000Z",
         "started": true,
         "completed": true,
         "success": true
       },
       "relationships" : {
           "learner" : {
               "data" : [
                   {
                       "id":"123456",
                       "type": "user"
                   }
               ]
           },
           "module" : {
               "data" : [
                   {
                       "id":"208893_511761_1",
                       "type": "courseModule"
                   }
               ]
           },
           "course" : {
               "data" : [
                   {
                       "id":"208893",
                       "type": "course"
                   }
               ]
           }
       }
    }
    }