Versions Compared

Key

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

Problem Statement

Currently to update the content implementation team needs to make multiple calls, which makes it a difficult process. Additionally there is no auditing in place to track as content was updated by whom. There should be an easier way to update the content.

Jira Legacy
serverSystem JIRA
columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
serverId2207a759-5bc8-39c5-9cd2-aa9ccc1f65dd
keySB-10220

Solution Approach

Solution approach to overcome the problem has below components

  1. Sunbird Platform will expose an API for end user to initiate update content
  2. Sunbird Platform will internally call Content Service with the request provided by User
  3. Content Service will validate the request
  4. With valid request, Content Service will initiate the update process through kafka pipeline and will return unique process ID identifying the process.
  5. With Invalid request, Content Service will return error message which Sunbird platform will return to User
  6. For valid response from Content Service, processId with other details will be saved in Sunbird platform DB
Problem Statement

What is the API for update content?

Solution approach

URL:

POST /v1/content/update

Headers:

Authorization

X-authenticated-user-token

Request Params:

nametype description
scriptStringname of the script to be run by Content Service
versionStringthe version of the script
contentMapadditional parameters which would work as arguments for the scripts

Response Params:

nametypedescription
processIdStringunique identifier of the process started for the request, needed to get the status of the process

Errors:

status codeerror codeerror message
400MANDATORY_PARAMETER_MISSINGMandatory parameter {script,version} is missing.
400UPDATE_FAILEDData updation failed due to invalid Request

Sample Request and Response:


No Format
nopaneltrue
Request

{
	request : {
		"script" : "course_rename",
		"version" : "1.2",
		"content" : {
			"oldName" : "AB",
			"newName" : "ab"
		}	
	}
}

Response

{
  "id": "api.content.update",
  "result": {
		"processId" : "01262366359399628812"
	}
}


Problem Statement

How we store the process information in DB

Solution approach

content_update_process table structure should be as below

columntype description
idtextholds process id
requesttextholds the input request as it is
statustextthe status last received from content service
messagetextmessage from content service in case of failure
createdbytextuserid of one who invoked the process
createdattimestamp

when the process was started

updatedattimestampwhen the process was last updated


Problem Statement

What is the API for getting the process status

Solution approach

URL:

GET /v1/content/update/status/{processId}

Headers:

Authorization

Request Params:

None

Response Params:

nametypedescription
statustextstatus as COMPLETED or FAILURE
messagetextcontains error messages in case of failure

Errors:

status codeerror codeerror message
400INVALID_PROCESS_IDInvalid Process Id

Sample Request and Response:

No Format
nopaneltrue
Request

GET /v1/content/update/status/01262366359399628812

Response

{
  "id": "api.content.update.status",
  "result": {
		"status" : "FAILURE",
		"message" : "Operation to update failed"
	}
}


Deprecated SOLUTION APPROACH

Solution approach is divided into multiple part

  • There should be generated key to facilitate the process of update of content in a channel by anyone who has the key, hence bypassing the user authentication process . The details of the master key generation design and approach are here (Master Key APIs).
  • Auditing of the update of the content by keys.