description |
---|
This API is used to update the existing question on the Sunbird-inQuiry Platform. |
{% swagger method="patch" path="/question/v1/update/{Question_Id}" baseUrl="" summary="This API is used to update the existing question on the Sunbird-inQuiry Platform." expanded="true" %}
{% swagger-description %}
• /update endpoint executes the "Update Question" request based on parameters provided as metadata in the request body. Users can provide updated attributes and their values in a request.
• It points to inquiry-api-service (assessment service) - /question/v4/update
• You need to provide a valid Question Id value in {Question_Id} field of the API URL.
• It is mandatory to provide values for parameters marked with *.
• Mandatory fields cannot be null or empty.
• Question schema check here
{% endswagger-description %}
{% swagger-parameter in="path" name="Question_Id" type="String" required="true" %} Append a valid Question ID To the Request URL {% endswagger-parameter %}
{% swagger-parameter in="header" name="Content-Type" type="String" required="true" %} The Content-Type entity is the media type of the resource. It should be Application/json {% endswagger-parameter %}
{% swagger-parameter in="header" name="Authorization" type="String" required="true" %} To make use of the API, you require authorization. Raise a request to the administrator, for the use of the API. You will receive the authorization key. Specify the key received, here.
Set Bearer {{api_key}} {% endswagger-parameter %}
{% swagger-parameter in="body" name="request" type="Object" required="true" %} It contains metadata about the question to be updated. {% endswagger-parameter %}
{% swagger-parameter in="header" name="x-channel-id" type="String" %} Unique identification number associated with a root organization. {% endswagger-parameter %}
{% swagger-response status="200: OK" description="Successful operation. The 'Update Question' operation was successfuly executed." %}
{
"id": "api.question.update",
"ver": "3.0",
"ts": "2021-02-02T19:55:07ZZ",
"params": {
"resmsgid": "9d9d4824-cc40-4ac7-a3d6-6da61c0240e9",
"msgid": null,
"err": null,
"status": "successful",
"errmsg": null
},
"responseCode": "OK",
"result": {
"identifier": "do_113207924037746688110",
"versionKey": "1612295707004"
}
}
{% endswagger-response %}
{% swagger-response status="400: Bad Request" description="The 'Update Question' operation failed! The possible reason for failure is that you may have missed providing input for a mandatory parameter." %}
{
"id": "api.question.update",
"ver": "3.0",
"ts": "2021-02-02T19:56:20ZZ",
"params": {
"resmsgid": "fcfcf6d6-84f1-43f5-b573-c3b6cf69ef53",
"msgid": null,
"err": "CLIENT_ERROR",
"status": "failed",
"errmsg": "Invalid version Key"
},
"responseCode": "CLIENT_ERROR",
"result": {
"messages": null
}
}
{% endswagger-response %}
{% swagger-response status="404: Not Found" description="The Update Question operation failed! The possible reason for failure is that you may have provided wrong question ID." %}
{
"id": "api.question.update",
"ver": "3.0",
"ts": "2021-02-02T19:57:35ZZ",
"params": {
"resmsgid": "2b139ee9-f091-4cca-b466-32af45f49a65",
"msgid": null,
"err": "NOT_FOUND",
"status": "failed",
"errmsg": "Error! Node(s) doesn't Exists. | [Invalid Node Id.]: do_1132079240377466881101"
},
"responseCode": "RESOURCE_NOT_FOUND",
"result": {
"messages": null
}
}
{% endswagger-response %}
{% swagger-response status="500: Internal Server Error" description="Looks like something went wrong! These errors are tracked automatically." %}
{
"result": {},
"id": "string",
"ver": "string",
"ts": "string",
"params": {
"resmsgid": "string",
"msgid": "string",
"err": "string",
"status": "string",
"errmsg": "string"
},
"responseCode": "string"
}
{% endswagger-response %} {% endswagger %}
{
"request": {
"question":{
"name": "Updated value",
"versionKey": "{{versionKey}}"
}
}
}
Attribute | Type | Description | Required |
---|---|---|---|
versionKey | string | Represents the transaction update version key of the Question | Yes |
Attribute | Type | Description |
---|---|---|
identidier | String | Unique Question identifier |
versionKey | String | Unique version key for question |
curl --location -g --request PATCH '{{host}}/question/v1/update/{{question_id}}' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{api_key}}' \
--data-raw '{
"request": {
"question":{
"name": "Updated value",
"versionKey": "{{versionKey}}"
}
}
}'
Following is the complete request example of updating an existing Question. This is a Multiple Choice Questions (MCQ) type of question.
{
"request": {
"question": {
"media": [],
"editorState": {
"options": [
{
"answer": true,
"value": {
"body": "<p>a1</p>",
"value": 0
}
},
{
"answer": false,
"value": {
"body": "<p>a2</p>",
"value": 1
}
},
{
"answer": false,
"value": {
"body": "<p>a3</p>",
"value": 2
}
},
{
"answer": false,
"value": {
"body": "<p>a4</p>",
"value": 3
}
}
],
"question": "<p>question</p>"
},
"templateId": "mcq-vertical",
"answer": "0",
"bloomsLevel": "knowledge",
"maxScore": 1,
"name": "a1",
"responseDeclaration": {
"response1": {
"maxScore": 1,
"cardinality": "single",
"type": "integer",
"correctResponse": {
"value": "0",
"outcomes": {
"SCORE": 1
}
},
"mapping": []
}
},
"interactionTypes": [
"choice"
],
"interactions": {
"response1": {
"type": "choice",
"options": [
{
"label": "<p>a1</p>",
"value": 0
},
{
"label": "<p>a2</p>",
"value": 1
},
{
"label": "<p>a3</p>",
"value": 2
},
{
"label": "<p>a4</p>",
"value": 3
}
]
}
},
"qType": "MCQ",
"primaryCategory": "Multiple Choice Question",
"body": "<div class='question-body' tabindex='-1'><div class='mcq-title' tabindex='0'><p>question</p></div><div data-choice-interaction='response1' class='mcq-vertical'></div></div>",
"solutions": [
],
"board": "CBSE",
"medium": [
"English"
],
"gradeLevel": [
"Class 2"
],
"subject": [
"Mathematics"
],
"author": "[email protected]",
"channel": "01309282781705830427",
"framework": "ekstep_ncert_k-12",
"copyright": "NIT123",
"audience": [
"Student"
],
"license": "CC BY 4.0",
"programId": "18730310-5144-11ed-be8b-9962d8844469",
"collectionId": "do_11365081180508160011559",
"topic": [
"Addition through Carry Forward"
],
"isReviewModificationAllowed": false
}
}
}