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
Expand |
---|
title | POST - /v1/view/start |
---|
|
Request Spec: Code Block |
---|
| {
"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 |
---|
| SampleRequest1
{
"id": "api.view.start", | // mandatory. id of theapirequest 1.0 // mandatory. Current version of api 01-01T00:00:00+05:30", //mandatory. Timestamp of the request06-23 05:37:50:175+0000",
| 4f04da601e24-4d31-aa7b-1daf91c46341" // unique request message id, UUID
b072-440d-916e-da787881b1b9"
} | ,
"request": {
"userId" : "user_123",
| //requestdata} |
API Spec
Expand |
---|
title | POST - /v1/view/start |
---|
|
Request Spec: Sample2: consume content through collection Code Block |
---|
| {
"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 |
---|
| 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 |
---|
| {
"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 |
---|
| {
"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 |
---|
| {
"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 |
---|
| {
"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 |
Expand |
---|
title | POST - /v1/view/update |
---|
|
Request: Code Block |
---|
| {
"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 |
---|
| { "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" } } |
|
Expand |
---|
title | POST - | v1 | view/updateRequest: Code Block |
---|
| {
"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 |
---|
| {
"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 |
---|
| {
"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 |
---|
| 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 |
---|
|
Request: Code Block |
---|
| {
"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 |
---|
| {
"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 |
---|
| {
"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 |
---|
| {
"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 |
---|
| {
"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 |
---|
| {
"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 |
---|
| {
"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"
}]
}
} |
|
...
Expand |
---|
title | POST - /v1/assessment/read |
---|
|
Request: Code Block |
---|
| {
"request": {
"userId": "{{userId}}", //mandatory
"contentId" : ["do_123"{{contentId}}", "do_1234"], //mandatory
"collectionId" : "{{collectionId}}", //optionalmandatory
"contextId": "{{batchId}}" // optionalmandatory
}
} |
Response: Code Block |
---|
| {
"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 |
---|
title | POST - /v1/summary/read |
---|
|
Request: Code Block |
---|
{
"request": {
"userId": "{{userId}}", // mandatory
"collectionId" : "{{collectionId}}", // mandatory
"contextId": "{{batchId}}" //mandatory
}
} |
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}}",
"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 |
---|
title | GET - /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