Problem Statement
...
- Bulk Content Upload is to be supported in Sunbird, with 3 operation modes
- API to be made available to check the real-time status of the bulk content upload process
- API to be made available to list the statuses of processes initiated by an user
operation-mode | workflow |
---|---|
upload | create-upload content |
publish | create-upload-publish content |
link | create-upload-publish content and link it to textbook |
Design
...
API Specifications
Bulk Content Upload API - POST - /v1/textbook/content/bulk/upload
Request Headers
Content-Type | multipart/form-data |
Authorization | Bearer {{api-key}} |
x-authenticated-user-token | {{keycloak-token}} |
x-channel-id | {{channel-identifier}} |
x-framework-id | {{framework-identifier}} |
operation-mode | upload/publish/link |
...
Bulk Content Upload Status Check API - GET - /v1/textbook/content/bulk/upload/status/:processId
Request Headers
Accept | application/json |
Authorization | Bearer {{api-key}} |
x-authenticated-user-token | {{keycloak-token}} |
Response : Success Response - OK (200) - In Queue
...
Bulk Content Upload Status List API HTTP Method - GET API Endpoint - /v1/textbook/content/bulk/upload/status/list
Request Headers
Accept | application/json |
Authorization | Bearer {{api-key}} |
x-authenticated-user-token | {{keycloak-token}} |
Response : Success Response - OK (200) - In Queue
Code Block |
---|
{ "id": "api.textbook.content.bulk.upload.status.list", "ver": "v1", "ts": "2019-07-26 11:28:42:315+0000", "params": { "resmsgid": null, "msgid": "cf5b2e8e-70cf-401c-af29-980bc3151c67", "err": null, "status": "success", "errmsg": null }, "responseCode": "OK", "result": { "userId": "f61826aa-8e5d-4356-b8ad-edda92460750", "uploads": [ { "processId": "012813442982903808142", "uploadedDate": "2018-12-12 14:25:27:466+0530", "status": "Completed" }, { "processId": "012813442982903808143", "uploadedDate": "2018-12-14 12:01:36:807+0530", "status": "QueuedProcessing" } ] } } |
Response : Success Response - OK (200) - In Progress
Code Block |
---|
{ "id": "api.bulkupload.status", "ver": "v1", "ts": "2019-07-26 11:28:42:315+0000", "params": { "resmsgid": null, "msgid": "cf5b2e8e-70cf-401c-af29-980bc3151c67", "err": null, "status": "success", "errmsg": null }, "responseCode": "OK", "result": { "processId": "012813442982903808142", "status": "Processing", "totalCount": 500, "successCount": 100, "failedCount": 10, "startTime": "2019-07-26 11:28:42:315+0000" } } |
Response : Success Response - OK (200) - Completed
Code Block |
---|
{
"id": "api.bulkupload.status",
"ver": "v1",
"ts": "2019-07-26 11:28:42:315+0000",
"params": {
"resmsgid": null,
"msgid": "cf5b2e8e-70cf-401c-af29-980bc3151c67",
"err": null,
"status": "success",
"errmsg": null
},
"responseCode": "OK",
"result": {
"processId": "012813442982903808142",
"status": "Completed",
"totalCount": 500,
"successCount": 450,
"failedCount": 50,
"startTime": "2019-07-26 11:28:42:315+0000"
"endTime": "2019-07-26 12:28:42:315+0000",
"report": "signedDownloadUrl"
}
} |
Response : Failure Response - RESOURSE NOT FOUND (404) - ProcessId not found
Code Block |
---|
{
"id": "api.bulkupload.content",
"ver": "v1",
"ts": "2019-07-26 11:28:42:315+0000",
"params": {
"resmsgid": null,
"msgid": "cf5b2e8e-70cf-401c-af29-980bc3151c67",
"err": "PROCESS_NOT_FOUND",
"status": "PROCESS_NOT_FOUND",
"errmsg": "Process Id xxx is not found in the system"
},
"responseCode": "RESOURCE_NOT_FOUND",
"result": { }
} |