Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction:

This wiki give the details about Viewer Service API(s) Spec design details.

Base Request Spec:

API of type post will follow below request structure

...

Introduction:

This wiki give the details about Viewer Service API(s) Spec design details.

Base Post Request Spec:

Code Block
{
    "id": "api.view", // mandatory. id of the api request
    "ver": "1.0",  // mandatory. Current version of api 
    "ts": "2021-01-01T00:00:00+05:30", //mandatory. Timestamp of the request
    "params": {
        "msgid": "4f04da60-1e24-4d31-aa7b-1daf91c46341" // unique request message id, UUID
    },
    request: {
        // request data
    }
    

API Spec

Content View Start

Expand
titlePOST - /v1/view/start

Request Spec:

Code Block
languagejson
{
    "id": "api.view.start",
    "ver": "v1",
    "ts": "2021-06-23 05:37:40:575+0000",
    "params": {
       "msgid": "5e763bc2-b072-440d-916e-da787881b1b9"
    },
    "request": {
        "userId": "{{userId}}",
        "contentId": "{{contentId}}"
        "collectionId" : "{{collectionId}}"  // optional
        "contextId": "{{batchId}}" // optional 
    }
}

Sample Requests:

Sample1: consume organic content

Code Block
languagejson
SampleRequest1
{
    "id": "api.view.start",
// mandatory. id of the

api
 
request
   
"ver": "
1.0
v1",
// mandatory. Current version of api

    "ts": "2021-
01-01T00:00:00+05:30", //mandatory. Timestamp of the request
06-23 05:37:50:175+0000",
    
"params": {
       
"msgid": "
4f04da60
5e763bc2-
1e24-4d31-aa7b-1daf91c46341" // unique request message id, UUID
b072-440d-916e-da787881b1b9"
    }
,

    "request": {
      "userId" : "user_123",
 
//
 
request
 
data
   "contentId" : 
}
"content_123"
    

API Spec

Content View Start

Expand
titlePOST - /v1/view/start
Request Spec:
}

Sample2: consume content through collection

Code Block
languagejson
{
    "id": "api.view.start",
    "ver": "v1",
    "ts": "2021-06-23 05:37:40:575+0000",
    "params": {
       "msgid": "5e763bc2-b072-440d-916e-da787881b1b9"
    }
    "request": {
 
      "userId": "{{userId}}",
        "contentId": "{{contentId}}" : "user_123",
      "collectionIdcontentId" : "{{collectionId}}"  // optional
 content_123",
      "contextIdcollectionId" : "{{batchId}}collection_123" //   optional  
   } }

Sample Requests:

Sample1:Sample3: consume content through context

Code Block
languagejson
SampleRequest1
{
    "id": "api.view.start",
    "ver": "v1",
    "ts": "2021-06-23 05:37:5040:175575+0000",
    "params": {
       "msgid": "5e763bc2-b072-440d-916e-da787881b1b9"da787881b1b9"
    }
    "request": {
      "userId" : "user_123",
    }  "contentId" :  "request": {content_123",
      "userIdcollectionId" : "usercollection_123",
      "contentIdcontextId" : "contentcontext_123"      
    }

Sample2Response:

200 Ok Response:

Code Block
languagejson
{
    "id": "api.view.start",
    "ver": "v1",
    "ts": "2021-06-23 05:37:40:575+0000",
    "params": {
        "resmsgid": null,
        "msgid": "5e763bc2-b072-440d-916e-da787881b1b9",
    }    "err": null,
        "requeststatus": "success",
{        "userIderrmsg": null
    },
    "responseCode": "user_123OK",
      "contentIdresult": {
: "content_123",       "collectionId{{contentId}}" : "collection_123Progress started"
    }

    }

Sample34XX or 5XX Error Response:

Code Block
languagejson
{
    "id": "api.view.start",
    "ver": "v1",
    "ts": "2021-06-23 05:37:40:575+0000",
    "params": {
        "resmsgid": null,
        "msgid": "5e763bc2-b072-440d-916e-da787881b1b9",
    }     "requesterr": { ERR_Error_Code,
        "userIdstatus" : "user_123failed",
        "contentIderrmsg" : "content_123",ERR_error_msg
    },
    "collectionIdresponseCode" : "collection_123BAD_REQUEST"/"SERVER_ERROR",
    "result": {
 "contextId" : "context_123"   // error message
    }
}

Sample Response:

200 Ok ResponseSample1: Valid Request

Code Block
languagejson
{
    "id": "api.view.start",
    "ver": "v1",
    "ts": "2021-06-23 05:37:40:575+0000",
    "params": {
        "resmsgid": null,
        "msgid": "5e763bc2-b072-440d-916e-da787881b1b9",
        "err": null,
        "status": "success",
        "errmsg": null
    },
    "responseCode": "OK",
    "result": {
        "{{contentId}}content_123": "Progress started"
    }
}

4XX or 5XX Error:Sample2: InValid Request

Code Block
languagejson
{
    "id": "api.view.start",
    "ver": "v1",
    "ts": "2021-06-23 05:37:40:575+0000",
    "params": {
        "resmsgid": null,
        "msgid": "5e763bc2-b072-440d-916e-da787881b1b9",
         "err": ERR_Error_Code"CLIENT_ERROR",
        "status": "failed",
        "errmsg": ERR_error_msg
    },
    "responseCode": "BAD_REQUEST",
    "result": {
   },     "responseCoderequest.contentId": "BAD_REQUEST"/"SERVER_ERROR",
    "result": {Content Id cannot be empty"
    }
}

Sample Response:

Sample1

Content View Update

Expand
titlePOST - /v1/view/update

Request:

Code Block
languagejson
{
    "id": "api.view.startupdate",
    "ver": "v1",
    "ts": "2021-06-23 05:37:40:575+0000",
    "params": {

       "resmsgid": null,
        "msgid": "5e763bc2-b072-440d-916e-da787881b1b9",
        "err": null,
        "status": "success",
    }
    "errmsgrequest": null
{
   },     "responseCodeuserId": "OK{{userId}}",
    "result": {         "content_123": "Progress started" // required  
  } }

Sample2:

Code Block
languagejson
{     "idcontentId": "api.view.start{{contentId}}",       "ver": "v1", // required   
 "ts": "2021-06-23 05:37:40:575+0000",     "paramscollectionId" : "{{collectionId}}", //optional. mandatory only when 
             "resmsgid": null,         "msgid": "5e763bc2-b072-440d-916e-da787881b1b9",          "err": "CLIENT_ERROR",         "status": "failed",        contextId "errmsg": ERR_error_msg
present in request
   },     "responseCodecontextId": "BAD_REQUEST{{batchId}}",          "result": {// optional
        "request.contentIdprogressDetails": "Content{} Id cannot be empty"     } }

Content View Update

POST - v1view/update
Expand
title
/
/

Request:

Code Block
languagejson
{
    "id": "api.view.update",
    "ver": "v1", mandatory. Progress details specific 
     "ts": "2021-06-23 05:37:40:575+0000",     "params": {        "msgid": "5e763bc2-b072-440d-916e-da787881b1b9"     }     "request": {         "userId": "{{userId}}",           for //each mandatorymimetype
    }
}

Sample Requests:

Sample1: Without Context

Code Block
languagejson
{
    "contentIdid": "{{contentId}}api.view.update",
    "ver": "v1",
 // mandatory  "ts": "2021-06-23 05:37:40:575+0000",
       "collectionIdparams" : "{{collectionId}}", //optional

       "contextIdmsgid": "{{batchId}}",5e763bc2-b072-440d-916e-da787881b1b9"
         // optional
  }
     "progressDetailsrequest": {}
      "userId" :  // mandatory. Progress details specific 
  "user_123",
      "contentId" : "content_123",
      "progressDetails" : {
         "mimetype"     : "appliation/pdf",
         "progress" : 20,
         "timespent" : 10
   for each mimetype
    }
}

Sample RequestSample1: With Context

Code Block
languagejson
{
    "id": "api.view.update",
    "ver": "v1",
    "ts": "2021-06-23 05:37:40:575+0000",
    "params": {
       "msgid": "5e763bc2-b072-440d-916e-da787881b1b9"
    }
    "request": {
      "userId" : "user_123",
      "contentId" : "content_123",
      "collectionId" : "collection_123",
      "contextId" : "context_123",
      "progressDetails" : {
         "mimetype" : "appliationapplication/pdf",
         "progress" : 20,
         "timespent" : 10
       }
}

Response:

Code Block
languagejson
200 OK:
{
    "id": "api.view.update",
    "ver": "v1",
    "ts": "2021-06-23 05:37:40:575+0000",
    "params": {
        "resmsgid": null,
        "msgid": "5e763bc2-b072-440d-916e-da787881b1b9",
        "err": null,
        "status": "success",
        "errmsg": null
    },
    "responseCode": "OK",
    "result": {
        "{{contentId}}": "Progress Updated"
    }
}

4XX or 5XX Error:
{
    "id": "api.view.update",
    "ver": "v1",
    "ts": "2021-06-23 05:37:40:575+0000",
    "params": {
        "resmsgid": null,
        "msgid": "5e763bc2-b072-440d-916e-da787881b1b9",
        "err": ERR_Error_Code,
        "status": "failed",
        "errmsg": ERR_error_msg
    },
    "responseCode": "BAD_REQUEST"/"SERVER_ERROR",
    "result": {
    }
}

...

Expand
titlePOST - /v1/view/end

Request:

Code Block
languagejson
{
    "id": "api.view.end",
    "ver": "v1",
    "ts": "2021-06-23 05:37:40:575+0000",
    "params": {
       "msgid": "5e763bc2-b072-440d-916e-da787881b1b9"
    }
    "request": {
        "userId": "{{userId}}",              //mandatory
        "contentId": "{{contentId}}"          //mandatory.
        "collectionId" : "{{collectionId}}",  // optional.mandatory only when 
                                                   contextId present in request 
        "contextId": "{{batchId}}",           // optional
    }
}

Sample Request::

Sample1: Without Context

Code Block
languagejson
{
    "id": "api.view.end",
    "ver": "v1",
    "ts": "2021-06-23 05:37:40:575+0000",
    "params": {
       "msgid": "5e763bc2-b072-440d-916e-da787881b1b9"
    }
    "request": {
      "userId" : "user_123",
      "contentId" : "content_123"
    }

Sample2: With Context

Code Block
languagejson
{
    "id": "api.view.end",
    "ver": "v1",
    "ts": "2021-06-23 05:37:40:575+0000",
    "params": {
       "msgid": "5e763bc2-b072-440d-916e-da787881b1b9"
    }
    "request": {
      "userId" : "user_123",
      "contentId" : "content_123",
      "collectionId" : "collection_123",
      "contextId" : "context_123"
,
   
    
}

Response:

Code Block
languagejson
{
    "id": "api.view.end",
    "ver": "v1",
    "ts": "2021-06-23 05:37:40:575+0000",
    "params": {
        "resmsgid": null,
        "msgid": "5e763bc2-b072-440d-916e-da787881b1b9",
        "err": null,
        "status": "success",
        "errmsg": null
    },
    "responseCode": "OK",
    "result": {
        "{{contentId}}": "Progress ended"
    }
}

...

Expand
titlePOST - /v1/view/read

Request:

Code Block
languagejson
{
    "id": "api.view.read",
    "ver": "v1",
    "ts": "2021-06-23 05:37:40:575+0000",
    "params": {
       "msgid": "5e763bc2-b072-440d-916e-da787881b1b9"
    }
    "request": {
        "userId": "{{userId}}",
        "contentIds": ["{{contentId_1}}", "{{contentId_2}}"],
        "collectionId" : "{{collectionId}}", //optional
        "contextId": "{{batchId}}"   // optional
     }
}

Response:

Code Block
languagejson
{
    "id": "api.view.read",
    "ver": "v1",
    "ts": "2021-06-23 05:37:40:575+0000",
    "params": {
        "resmsgid": null,
        "msgid": "5e763bc2-b072-440d-916e-da787881b1b9",
        "err": null,
        "status": "success",
        "errmsg": null
    },
    "responseCode": "OK",
    "result": {
    	"userId": "{{userId}}",
    	"collectionId": "{{collectionId}}", // optional
    	"contextId": "{{batchId}}",  // optional
        "contents": [{
          "identifiercontentId": "{contentId}",
          "progressDetailsstatus" : "{{content_status}}"   // 0,1 or 2 
 	  "score": {{best_score}},
    	  "max_scoreprogressDetails": {"{max_score}}"
        }]
    }
}

Sample Response:

Example1:

Code Block
{
    "id": "api.view.read",
    "ver": "v1",
    "ts": "2021-06-23 05:37:40:575+0000",
    "params": {
        "resmsgid": null,
        "msgid": "5e763bc2-b072-440d-916e-da787881b1b9",
        "err": null,
        "status": "success",
        "errmsg": null
    },
    "responseCode": "OK",
    "result": {
    	"userId": "user_123",
        "contents": [{
          "contentId": "content_123",
          "progressDetailsstatus" : "1"{,
             "progressprogressDetails": :20,"{
             "timespentprogress" :20,
10           }",  "timespent" : 10
	  "score": 5,     	  "max_score": 10}"
        }]
    }
}

Example2:

Code Block
languagejson
{
    "id": "api.view.read",
    "ver": "v1",
    "ts": "2021-06-23 05:37:40:575+0000",
    "params": {
        "resmsgid": null,
        "msgid": "5e763bc2-b072-440d-916e-da787881b1b9",
        "err": null,
        "status": "success",
        "errmsg": null
    },
    "responseCode": "OK",
    "result": {
    	"userId": "user_123",
        "collectionId" : "collection_!23",
        "contextId" : "context_123",
        "contents": [{
          "contentId": "content_123",
          "progressDetails": "{
             "progress" :20,
             "timespent" : 10
          }",
    	  "score": 5,   status : 	  "max_score": 10"1"
        }]
    }
}

Content Submit Assess

...

Expand
titlePOST - /v1/assessment/read

Request:

Code Block
languagejson
{
    "request": {
        "userId": "{{userId}}",            //mandatory
        "contentId" : ["do_123"{{contentId}}", "do_1234"],    //mandatory
        "collectionId" : "{{collectionId}}", //optionalmandatory
        "contextId": "{{batchId}}"   // optionalmandatory
   }
}

Response:

Code Block
languagejson
{
    "id": "api.assessment.read",
    "ver": "v1",
    "ts": "2021-06-23 05:37:40:575+0000",
    "params": {
        "resmsgid": null,
        "msgid": "5e763bc2-b072-440d-916e-da787881b1b9",
        "err": null,
        "status": "success",
        "errmsg": null
    },
    "responseCode": "OK",
    "result": {
    	"userId": "{{userId}}",
        "contentId" : "{{contentId}}"
    	"collectionId": "{{collectionId}}",
    	"contextId": "{{batchId}}",
        "assessments": [{
          "attemptId" : "{{attemptId}}",
    	  "score": {{score}},
    	  "max_score": {{max_score}}
        },{
          "attemptId" : "{{attemptId}}",
    	  "score": {{score}},
    	  "max_score": {{max_score}}
        }
        ]
    }
}

...

Expand
titlePOST - /v1/summary/read

Request:

Code Block
{
    "request": {
        "userId": "{{userId}}", // mandatory
        "collectionId" : "{{collectionId}}", // mandatory
        "contextId": "{{batchId}}" //mandatory
    }
}

Response:

Code Block
languagejson
{
  "id": "api.summary.read",
  "ver": "v1",
  "ts": "2021-06-23 05:59:54:984+0000",
  "params": {
    "resmsgid": null,
    "msgid": "95e4942d-cbe8-477d-aebd-ad8e6de4bfc8",
    "err": null,
    "status": "success",
    "errmsg": null
  },
  "responseCode": "OK",
  "result": {
        "userId": "{{userId}}",
        "collectionId": "{{collectionId}}",
        "contextId": "{{batchId}}",
        "enrolledDate": 1624275377301,
        "active": true,
        "contentStatus": {
          "{{contentId}}": {{status}}
        },
        "assessmentStatus": {
          "assessmentId": {
            "score": {{best_score}},
            "max_score": {{max_score}}
          }
        },
        "collection": {
          "identifier": "{{collectionId}}",
          "name": "{{collectionName}}",
          "logo": "{{logo Url}}",
          "leafNodesCount": {{leafNodeCount}},
          "description": "{{description}}"
        },
        "issuedCertificates": [{
          "name": "{{certName}}",
          "id": "certificateId",
          "token": "{{certToken}}",
          "lastIssuedOn": "{{lastIssuedOn}}"
        }],
        "completedOn": {{completion_date}},
        "progress": {{progress}},
        "status": {{status}}
  }
}

...

Expand
titleGET - /v1/summary/download/:userId

Response:

Code Block
{
    "id": "api.summary.download",
    "ver": "v1",
    "ts": "2021-06-23 05:37:40:575+0000",
    "params": {
        "resmsgid": null,
        "msgid": "5e763bc2-b072-440d-916e-da787881b1b9",
        "err": null,
        "status": "success",
        "errmsg": null
    },
    "responseCode": "OK",
    "result": {
      "url": "{{userId}}_viewer_summary.json"
    }
}

Clarifications:

  • For assessment submit, do we need consider the assess events without context as well