...
Table - user_content_counsumption
PRIMARY KEY (userid, collectionid, contextid, contentid) [userid, courseid, batchid, contentid)]
Key words used in below table:
...
| Scenario | Write Request | Read Request(Condition) |
---|
1 | User consuming individual content. [New] | Code Block |
---|
| {
"userid": "<<userid>>",
"courseidcollectionid": "<<contentid>>",
"batchidcontextid": "<<contentid>>",
"contentid": "<<contentid>>"
} |
| WHERE userid='<<userid>>' and courseid collectionid ='<<contentid>>' |
2 | User consuming a content with in a collection. [Existing] | Code Block |
---|
| {
"userid": "<<userid>>",
"courseidcollectionid": "<<courseid>>",
"batchidcontextid": "<<batchid>>",
"contentid": "<<contentid>>"
} |
| WHERE userid='<<userid>>' and courseid collectionid ='<<courseid>>' and batchid contextid ='<<batchid>>' and contentid='<<contentid>>' |
3 | User consuming a content with in a collection. [New] | Code Block |
---|
| {
"userid": "<<userid>>",
"courseidcollectionid": "<<courseid>>",
"batchidcontextid": "<<batchid>><<courseid>>",
"contentid": "<<contentid>>"
} |
Note: When it is consumed with in this context. | WHERE userid='<<userid>>' and courseid ='<<contentid>>' OR collectionid ='<<courseid>>' OR WHERE userid='<<userid>>' and collectionid ='<<courseid>>' and contextid ='<<courseid>>' and contentid='<<contentid>>' |
4 | User consuming a content within a course part of a program | Code Block |
---|
| {
"userid": "<<userid>>",
"collectionid": "<<courseid>>",
"contextid": "<<batchid>>",
"contentid": "<<contentid>>"
} |
| WHERE userid='<<userid>>' and collectionid ='<<courseid>>' and contextid in (select batchId from program where collectionid='<<courseid>>') |
5 | User consuming a content within a course part of a program | Code Block |
---|
| {
"userid": "<<userid>>",
"collectionid": "<<courseid>>",
"contextid": "<<courseid>>",
"contentid": "<<contentid>>"
} |
| WHERE userid='<<userid>>' and courseid collectionid ='<<courseid>>' and batchid contextid = '<<batchid>>' and contentid ='<<contentid>><<courseid>>' |
Content View Lifecycle:
When the user view the content in context of a collection and batch, for the first time its start, progress update and end triggers are processed. Revisit (2nd - nth view) of the content will be ignored to process and update the DB.
...
Expand |
---|
title | POST - /v1/view/start |
---|
|
Request: Code Block |
---|
| {
"request": {
"userId": "{{userId}}",
"collectionId" : "{{collectionId}}",
"batchIdcontextId": "{{batchId}}",
"contentId": "{{contentId}}"
}
} |
Response: Code Block |
---|
| {
"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}}": "Progress started"
}
}
|
|
...
Expand |
---|
title | POST - /v1/view/update |
---|
|
Request: Code Block |
---|
| {
"request": {
"userId": "{{userId}}",
"collectionId" : "{{collectionId}}",
"batchIdcontextId": "{{batchId}}",
"contentId": "{{contentId}}",
"progress": 34"progressDetails": {}, // Progress details specific for each mimetype
"timespent": 10 // Timespent in seconds
}
} |
Response: Code Block |
---|
| 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}}": "SUCCESS"
}
}
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 |
---|
title | POST - /v1/assessment/submit |
---|
|
Request: Code Block |
---|
| {
"request": {
"userId": "{{userId}}",
"collectionId" : "{{collectionId}}",
"batchIdcontextId": "{{batchId}}",
"contentId": "{{contentId}}",
"assessments": [{
{{assess_event}} //Mandatory for self-assess contents
}]
}
} |
Response: Code Block |
---|
{
"id": "api.view.assess",
"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}}": "SUCCESS"
}
} |
|
...
Expand |
---|
|
Request: Code Block |
---|
| {
"request": {
"userId": "{{userId}}",
"collectionId" : "{{collectionId}}",
"batchIdcontextId": "{{batchId}}",
"contentId": "{{contentId}}"
}
} |
Response: Code Block |
---|
| {
"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 |
---|
title | POST - /v1/view/read |
---|
|
Request: Code Block |
---|
| {
"request": {
"userId": "{{userId}}",
"contentId": ["do_123", "do_1234"],
"collectionId" : "{{collectionId}}", //optional
"batchIdcontextId": "{{batchId}}" // optional
}
} |
Response: 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": "{{userId}}",
"collectionId": "{{collectionId}}",
"batchIdcontextId": "{{batchId}}",
"contents": [{
"identifier": "{contentId}",
"progress": 45,
"score": {{best_score}},
"max_score": {{max_score}}
}]
}
}
|
|
...
Expand |
---|
title | POST - /v1/summary/read |
---|
|
Request: Code Block |
---|
{
"request": {
"userId": "{{userId}}",
"collectionId" : "{{collectionId}}",
"batchIdcontextId": "{{batchId}}"
}
} |
Response: Code Block |
---|
| {
"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}}",
"batchIdcontextId": "{{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}}
}
}
|
|
...