...
objectType | metadata | Current Data Type (v1 api) | Expected Data Type (v2 api) | Comment |
---|---|---|---|---|
QuestionSet | instructions | object | object | |
QuestionSet | feedback | object | object | |
Question | body | string | object | |
Question | instructionsanswer | objectstring | object | |
Question | answerinstructions | stringobject | object | |
Question | hints | array of string | object | |
Question | feedback | object | object | |
Question | solutions | array of object | object | |
Question | interactions | object | object |
...
inQuiry will provide Question & QuestionSet V2 api’s which will provide CRUD operation for multilingual data.
api versionPublicly Exposed API | Service Level API’s | qumlVersion | schemaVersion | version | compatibilityLevel |
---|---|---|---|---|---|
v1 v1 api’s | v4 api’s | supports 1.0 but not stamped in the data as of now. | 1.0 | 1 | 5 |
v2 api’s | v5 api’s | supports 1.0 | 2.0 | 21 onwards. | 6 |
version or schemaVersion metadata will be set as 2 by default from micro-service for v2 api’s.
Current
compatibilityLevel
is set to 5 for the data created using v1 api’s. For v2 api’s, it will be set to 6 so that users should be able to discover and play only on latest app having latest player.async-questionset-publish flink job will handle different data validation based on schemaVersion / version.
schemaVersion will be used inside player, based on schemaVersion, player will switch the logic to process data.
player won't understand comaptibilityLevel, but will upgrade it to 6 for backward compatibility (existing apps).
data versioning will be implemented to store multiple version data at platform.
if quml specification will get updated in future,
if it is a minor change, the change can be accommodated in v2 api’s.
if spec will have major breaking change, we need to write next version of api’s.
For existing data created using v1 api’s, we have two approach as mentioned below:
No static Data Migration for existing objects and data transformation in question read & list api at run time to support v2 api spec.
One time static Data Migration
No Static Migration:
Pros:
Old version of questionset-editor & mobile app works fine with v1 api.
Once older questions edited using v2 editor and api's, it will be migrated to v2 data model. So end user (consumption) won’t be affected on immediate basis and at that point old player will not be able to discover the question (comaptibilityLevel will be upgraded to maintain backward compatibility of Sunbird-Ed mobile app).
Cons:
Platform need to understand all multi-language data (including editorState) and transform it to v2 api format for every read & list api call.
API Performance will be affected (specially question list api). To improve performance, cache will be implemented for list api to hold data post data transformation (currently no cache implementation present for list api).
Once the data is migrated to v2 data model, old player will not be able to discover the question (comaptibilityLevel will be upgraded).
Static Migration:
Pros:
Consumption api’s (question read & list api) doesn't need any run-time data transformation. So api performance won’t be affected.
Cons:
old mobile app won't be able to render existing questions for online consumption.
old editor also start breaking even for v1 api’s
API Specification:
Question Create API:
request_1:
...
language | json |
---|
...
inquiry v2 api’s will support multiple QuML version.
It support QuML version 1.1 onwards.
For each version of QuML, inquiry will maintain different schema folder.
User can send the qumlVersion metadata in create request payload. if it is valid, payload will be validated against respective schema.
If user doesn’t provide qumlVersion, micro-service will use default qumlVersion configured in micro-service through a service level configuration.
micro-service will also maintain a configuration for all supported QuML version. e.g: api_v5_supported_quml_version=[1.1, 1.2, 1.3]
inquiry will stamp qumlVersion to all objects created through v2 api’s and same will be used during read and update api’s calls.
once question or questionset created against a specific QuML version, qumlVersion can’t be upgraded/downgraded through update api’s. It is restricted to avoid any data corruption.
addition of new quml version require few code changes like adding schema and application configurations, code changes to flink job.
Current
compatibilityLevel
is set to 5 for the data created using v1 api’s. For v2 api’s, it will be set to 6 so that users should be able to discover and play only on latest app having latest player.Going forward, adopters should use qumlVersion metadata to control discovery of question/questionset.
QuML player won't understand comaptibilityLevel, but will upgrade it to 6 for backward compatibility (existing apps).
qumlVersion should be used by QuML player.
QuML payer should use the metadata for checking player compatibility. This will remove dependency of metadata compatibilityLevel at application layer.
based on qumlVersion, player should switch the logic to process data.
data filter based on language capability will be enabled for question read and list api’s. query parameter lang=language_code will be used. e.g: ?lang=en
As of now, inquiry v2 api’s will not follow spec for below properties
properties: interactions & visibility
interactions: will be implemented, once format is generalised for all question types at spec level.
visibility: inquiry will continue to use default visibility which is used as public visibility across all components including other building blocks.
async-questionset-publish flink job will handle different data validation based on qumlVersion.
v2 review & publish api won’t allow data having qumlVersion less than 1.1
existing data having qumlVersion 1.0 must be migrated before sending to review & publish v2 api’s.
inquiry will provide auto-migration to qumlVersion 1.1 using v2 update api.
question & questionset v1 api’s will be enhanced to throw an error, when user try to read/update data created using v2 api’s. qumlVersion check will be enabled for v1 api’s as well to achieve the behaviour.
For existing data created using v1 api’s, we have two approach as mentioned below:
No static Data Migration for existing objects and data transformation in question read & list api at run time to support v2 api spec.
One time static Data Migration
No Static Migration:
Pros:
Old version of questionset-editor & mobile app works fine with v1 api.
Once older questions edited using v2 editor and api's, it will be migrated to v2 data model. So end user (consumption) won’t be affected on immediate basis and at that point old mobile app will not be able to discover the question (comaptibilityLevel will be upgraded to maintain backward compatibility of Sunbird-Ed mobile app).
Cons:
Platform need to understand all multi-language data (including editorState) and transform it to v2 api format for every read & list api call.
API Performance will be affected (specially question list api). To improve performance, cache will be implemented for list api to hold data post data transformation (currently no cache implementation present for list api).
Once the data is migrated to v2 data model, old player will not be able to discover the question (comaptibilityLevel will be upgraded).
Static Migration:
Pros:
Consumption api’s (question read & list api) doesn't need any run-time data transformation. So api performance won’t be affected.
Cons:
old mobile app won't be able to render existing questions for online consumption.
old editor also start breaking even for v1 api’s
API Specification:
Question Create API:
Sample Input for single language:
Code Block | ||
---|---|---|
| ||
{
"name": "Name of the question",
"code": "unique code of the question",
"mimeType": "application/vnd.sunbird.question",
"primaryCategory": "Multiple Choice Question",
"interactionTypes": ["choice"],
"qumlVersion": 1.1,
"media": [
{
"id": "do_2137498365362995201237",
"type": "image",
"src": "/assets/public/content/assets/do_2137498365362995201237/tea.jpeg",
"baseUrl": "https://dev.inquiry.sunbird.org"
}
],
"body": "<div class='question-body' tabindex='-1'><div class='mcq-title' tabindex='0'><p><span style=\"background-color:#ffffff;color:#202124;\">Which of the following crops is a commercial crop?</span></p></div><div data-choice-interaction='response1' class='mcq-vertical'></div></div>",
"answer": "<p>Barley</p>",
"instructions": {
"language_code": "<div>...</div>"
},
"hints": {
"hint_1": "<div>...</div>",
"hint_2": "<div>...</div>"
},
"feedback": {
"feedback_1": "<div>...</div>",
"feedback_2": "<div>...</div>"
},
"solutions": {
"solution_1": "solution 1 html string",
"solution_2": "solution 2 html string"
},
"interactions": {
"response1": {
"type": "choice",
"options": [
{
"label": "<p>Wheat</p>",
"value": "w"
},
{
"label": "<p>Barley</p>",
"value": "b"
},
{
"label": "<p>Maize</p>",
"value": "m"
},
{
"label": "<p>Tea</p>",
"value": "t"
}
],
"validation": {
"required": "Yes"
}
}
},
"responseDeclaration": {
"response1": {
"cardinality": "single",
"type": "integer",
"correctResponse": {
"value": 3
},
"mapping": [
{
"value": 2,
"score": 0.5
},
{
"value": 1,
"score": 0.25
}
]
}
},
"outcomeDeclaration": {
"maxScore": {
"cardinality": "single",
"type": "integer",
"defaultValue": 3
}
},
// any additional properties goes here. e.g: framework, createdBy, etc..
} |
In the above request spec, a default language code (configured in the system at object level schema) will be injected and data will be transformed (as mentioned in multi language format ) to v2 format and then saved to database.
The data transformation will be done to support both formats mentioned in quml specification.
Sample Input for multi-language (default input):
Code Block | ||
---|---|---|
| ||
{
"name": "Name of the question",
"code": "unique code of the question",
"mimeType": "application/vnd.sunbird.question",
"primaryCategory": "Multiple Choice Question",
"interactionTypes": ["choice"],
"qumlVersion": 1.1,
"media": [
{
"id": "do_2137498365362995201237",
"type": "image",
"src": "/assets/public/content/assets/do_2137498365362995201237/tea.jpeg",
"baseUrl": "https://dev.inquiry.sunbird.org"
}
],
"body": {
"language_code": "<div class='question-body' tabindex='-1'><div class='mcq-title' tabindex='0'><p><span style=\"background-color:#ffffff;color:#202124;\">Which of the following crops is a commercial crop?</span></p></div><div data-choice-interaction='response1' class='mcq-vertical'></div></div>"
},
"answer": {
"language_code": "<p>Barley</p>"
},
"instructions": {
"language_code": "<div>...</div>"
},
"hints": {
"hint_1": {
"language_code": "<div>...</div>"
},
"hint_2": {
"language_code": "<div>...</div>"
}
},
"feedback": {
"feedback_1": {
"language_code": "<div>...</div>"
},
"feedback_2": {
"language_code": "<div>...</div>"
}
},
"solutions": {
"solution_1": {
"language_code": "<div>...</div>"
},
"solution_2": {
"language_code": "<div>...</div>"
}
},
"interactions": {
"response1": {
"type": "choice",
"options": [
{
"label": {
"language_code": "<p>Wheat</p>"
},
"value": 1
},
{
"label": {
"language_code": "<p>Barley</p>"
},
"value": 2
},
{
"label": {
"language_code": "<p>Maize</p>"
},
"value": 3
},
{
"label": {
"language_code": "<p>Tea</p>"
},
"value": 4
}
],
"validation": {
"required": "Yes"
}
}
},
"responseDeclaration": {
"response1": {
"cardinality": "single",
"type": "integer",
"correctResponse": {
"value": 3
},
"mapping": [
{
"value": 2,
"score": 0.5
},
{
"value": 1,
"score": 0.25
}
]
}
},
"outcomeDeclaration": {
"maxScore": {
"cardinality": "single",
"type": "integer",
"defaultValue": 3
}
},
// any additional properties goes here. e.g: framework, createdBy, etc..
} |
Success Response (200):
Code Block | ||
---|---|---|
| ||
{
"id": "api.question.create",
"ver": "5.0",
"ts": "2023-01-30T19:43:43ZZ",
"params": {
"resmsgid": "ca1ed6b6-994d-487c-8ecd-0ca164a84c94",
"msgid": null,
"err": null,
"status": "successful",
"errmsg": null
},
"responseCode": "OK",
"result": {
"identifier": "do_2137224832856555521270",
"versionKey": "1675107822985"
}
} |
Question Read API:
Request:
Code Block |
---|
curl --location --request GET 'https://dev.inquiry.sunbird.org/api/question/v2/read/do_213688205764337664161?mode=edit&fields=answer,instructions' \
--header 'Authorization: {{api_key_new}}' |
Response:
question read api will always return will data in below format:
Code Block | ||
---|---|---|
| ||
{
"id": "api.question.read",
"ver": "5.0",
"ts": "2023-01-30T03:28:23ZZ",
"params": {
"resmsgid": "db23eb9e-207c-488c-a45a-7da36a2084ee",
"msgid": null,
"err": null,
"status": "successful",
"errmsg": null
},
"responseCode": "OK",
"result": {
"question": {
"identifier": "do_213688205764337664161",
"qumlVersion": 1.1,
"media": [
{
"id": "do_2137498365362995201237",
"type": "image",
"src": "/assets/public/content/assets/do_2137498365362995201237/tea.jpeg",
"baseUrl": "https://dev.inquiry.sunbird.org"
}
],
"body": {
"language_code": "<div class='question-body' tabindex='-1'><div class='mcq-title' tabindex='0'><p><span style=\"background-color:#ffffff;color:#202124;\">Which of the following crops is a commercial crop?</span></p></div><div data-choice-interaction='response1' class='mcq-vertical'></div></div>"
},
"answer": {
"language_code": "<p>Barley</p>"
},
"instructions": {
"language_code": "<div>...</div>"
},
"hints": {
"hint_1": {
"language_code": "<div>...</div>"
},
"hint_2": {
"language_code": "<div>...</div>"
}
},
"feedback": {
"feedback_1": {
"language_code": "<div>...</div>"
},
"feedback_2": {
"language_code": "<div>...</div>"
}
},
"solutions": {
"solution_1": {
"language_code": "<div>...</div>"
},
"solution_2": {
"language_code": "<div>...</div>"
}
},
"interactions": {
"response1": {
"type": "choice",
"options": [
{
"label": {
"language_code": "<p>Wheat</p>"
},
"value": 1
},
{
"label": {
"language_code": "<p>Barley</p>"
},
"value": 2
},
{
"label": {
"language_code": "<p>Maize</p>"
},
"value": 3
},
{
"label": {
"language_code": "<p>Tea</p>"
},
"value": 4
}
],
"validation": {
"required": "Yes"
}
}
},
"responseDeclaration": {
"response1": {
"cardinality": "single",
"type": "integer",
"correctResponse": {
"value": 3
},
"mapping": [
{
"value": 2,
"score": 0.5
},
{
"value": 1,
"score": 0.25
}
]
}
},
"outcomeDeclaration": {
"maxScore": {
"cardinality": "single",
"type": "integer",
"defaultValue": 3
}
}
}
}
} |
the read api transforms data created using v1 api’s. It injects default language code configured in the system at object level schema and return the response to user.
same transformation will be applicable in Question List API
if specific language data is demanded using query param lange=language_code then only that language data will be returned.
if the requested language data is not available, api will return system default language data.
what should be behaviour????
Question Update API:
Question Update API also support both spec as mentioned in create api.
For older data (created with v1 api’s), on v2 api update call, data will be migrated to v2 api format as well as qumlVersion will be set to 1.1.
Sample Input for Update API (single language):
Code Block | ||
---|---|---|
| ||
{
"name": "Name of the question",
"versionKey": "123456"
"media": [
{
"id": "do_2137498365362995201237",
"type": "image",
"src": "/assets/public/content/assets/do_2137498365362995201237/tea.jpeg",
"baseUrl": "https://dev.inquiry.sunbird.org"
}
],
"body": "<div class='question-body' tabindex='-1'><div class='mcq-title' tabindex='0'><p><span style=\"background-color:#ffffff;color:#202124;\">Which of the following crops is a commercial crop?</span></p></div><div data-choice-interaction='response1' class='mcq-vertical'></div></div>",
"answer": "<p>Barley</p>",
"instructions": {
"language_code": "<div>...</div>"
},
"hints": {
"hint_1": "<div>...</div>",
"hint_2": "<div>...</div>"
},
"feedback": {
"feedback_1": "<div>...</div>",
"feedback_2": "<div>...</div>"
},
"solutions": {
"solution_1": "solution 1 html string",
"solution_2": "solution 2 html string"
},
"interactions": {
"response1": {
"type": "choice",
"options": [
{
"label": "<p>Wheat</p>",
"value": "w"
},
{
"label": "<p>Barley</p>",
"value": "b"
},
{
"label": "<p>Maize</p>",
"value": "m"
},
{
"label": "<p>Tea</p>",
"value": "t"
}
],
"validation": {
"required": "Yes"
}
}
},
"responseDeclaration": {
"response1": {
"cardinality": "single",
"type": "integer",
"correctResponse": {
"value": 3
},
"mapping": [
{
"value": 2,
"score": 0.5
},
{
"value": 1,
"score": 0.25
}
]
}
},
"outcomeDeclaration": {
"maxScore": {
"cardinality": "single",
"type": "integer",
"defaultValue": 3
}
}
} |
Sample Input for Update API (default input format):
Code Block | ||
---|---|---|
| ||
{
"versionKey": "12345"
"name": "Name of the question",
"media": [
{
"id": "do_2137498365362995201237",
"type": "image",
"src": "/assets/public/content/assets/do_2137498365362995201237/tea.jpeg",
"baseUrl": "https://dev.inquiry.sunbird.org"
}
],
"body": {
"language_code": "<div class='question-body' tabindex='-1'><div class='mcq-title' tabindex='0'><p><span style=\"background-color:#ffffff;color:#202124;\">Which of the following crops is a commercial crop?</span></p></div><div data-choice-interaction='response1' class='mcq-vertical'></div></div>"
},
"answer": {
"language_code": "<p>Barley</p>"
},
"instructions": {
"language_code": "<div>...</div>"
},
"hints": {
"hint_1": {
"language_code": "<div>...</div>"
},
"hint_2": {
"language_code": "<div>...</div>"
}
},
"feedback": {
"feedback_1": {
"language_code": "<div>...</div>"
},
"feedback_2": {
"language_code": "<div>...</div>"
}
},
"solutions": {
"solution_1": {
"language_code": "<div>...</div>"
},
"solution_2": {
"language_code": "<div>...</div>"
}
},
"interactions": {
"response1": {
"type": "choice",
"options": [
{
"label": {
"language_code": "<p>Wheat</p>"
},
"value": 1
},
{
"label": {
"language_code": "<p>Barley</p>"
},
"value": 2
},
{
"label": {
"language_code": "<p>Maize</p>"
},
"value": 3
},
{
"label": {
"language_code": "<p>Tea</p>"
},
"value": 4
}
],
"validation": {
"required": "Yes"
}
}
},
"responseDeclaration": {
"response1": {
"cardinality": "single",
"type": "integer",
"correctResponse": {
"value": 3
},
"mapping": [
{
"value": 2,
"score": 0.5
},
{
"value": 1,
"score": 0.25
}
]
}
},
"outcomeDeclaration": {
"maxScore": {
"cardinality": "single",
"type": "integer",
"defaultValue": 3
}
}
} |
Response:
Code Block | ||
---|---|---|
| ||
{
"id": "api.question.update",
"ver": "5.0",
"ts": "2023-01-30T19:43:43ZZ",
"params": {
"resmsgid": "ca1ed6b6-994d-487c-8ecd-0ca164a84c94",
"msgid": null,
"err": null,
"status": "successful",
"errmsg": null
},
"responseCode": "OK",
"result": {
"identifier": "do_2137224832856555521270",
"versionKey": "1675107822985"
}
} |
Question Review API :
there is no change in spec from v1 to v2 api.
For older data, the api will throw client error if the qumlVersion is 1.0.
Question Publish API:
there is no change in spec from v1 to v2 api.
For older data, the api will throw client error if the qumlVersion is 1.0.
Question Retire API:
there is no change in spec from v1 to v2 api.
there is no change for logical behaviour of the api
Question Copy API:
there is no change in spec from v1 to v2 api.
the api will support copy operation only if object qumlVersion match with default qumlVersion supported by the micro-service.
For older data, the api will throw client error if the qumlVersion is 1.0. First the data should be migrated.
QuestionSet API’s:
QuestionSet Create API:
there is no change in spec from v1 to v2 api.
for instructions metadata, editor need to send specific language code in the data.
if language code is not supplied, default language code will be injected at platform level.
QuestionSet Read API & Hierarchy Read API:
For older data, language code will be stamped and data transformation will be done before returning the response for below fields:
instructions, hints & feedback
data sample:
Code Block "instructions": { "language_code": "<div>...</div>" }, "hints": { "hint_1": { "language_code": "<div>...</div>" }, "hint_2": { "language_code": "<div>...</div>" } }, "feedback": { "feedback_1": { "language_code": "<div>...</div>" }, "feedback_2": { "language_code": "<div>...</div>" } }
QuestionSet Update Hierarchy API:
Sample Input Request with single language attributes:
Code Block | ||
---|---|---|
| ||
{ "request": { "data": { "nodesModified": { "q1": { "metadata": { "name": "Name of the question", "code": "q1", "mimeType": "application/vnd.sunbird.question", "primaryCategory": "Multiple Choice Question", "interactionTypes": [ "choice" ], "qumlVersion": 1.1, "media": [ { "id": "do_2137498365362995201237", "type": "image", "src": "/assets/public/content/assets/do_2137498365362995201237/tea.jpeg", "baseUrl": "https://dev.inquiry.sunbird.org" } ], "body": "<div class='question-body' tabindex='-1'><div class='mcq-title' tabindex='0'><p><span style=\"background-color:#ffffff;color:#202124;\">Which of the following crops is a commercial crop?</span></p></div><div data-choice-interaction='response1' class='mcq-vertical'></div></div>", "answer": "<p>Barley</p>", "instructions": { "language_code": "<div>...</div>" }, "hints": { "hint_1": "<div>...</div>", "hint_2": "<div>...</div>" }, "id": "bc6e4294-1a19-4e75-fb43-871f0e54b0e8",feedback": { "typefeedback_1": "html<div>...</div>", "valuefeedback_2": "solution in HTML format"<div>...</div>" }, { "solutions": { "id": "bc6e4294-1a19-4e75-fb43-871f0e54b0e9", "typesolution_1": "solution 1 html string", "value "solution_2": "a question can have more than one solution. in such cases, another solution in HTML format"2 html string" }, ], "interactions": { "response1": { "type": "choice", "options": [ { { "label": "<p>Floral organs</p>", "valuelabel": 0"<p>Wheat</p>", }, "value": "w" { "label": "<p>Veins and veinlets in a lamina</p>", }, "value": 1 { } ] }"label": "<p>Barley</p>", "validation": { "requiredvalue": "Yesb" } } } } } |
...
, |
...
The data transformation will be done to support both formats mentioned in quml specification.
request_2:
Code Block | ||
---|---|---|
| ||
{ "request": { "question": { "name": "question_title", { "code": "{{$randomUUID}}", "mimeType": "application/vnd.sunbird.question", "primaryCategorylabel": "Multiple Choice Question","<p>Maize</p>", "body": { "language_code_1value": "questionm" body as string in specified language." }, }, "instructions": { "language_code": "instructions in HTML format." { }, "answer": { "language_codelabel": "answer in specified language"<p>Tea</p>", }, "hintsvalue": {"t" "language_code": [ } "hint-1", "hint-2" ], ] }, "feedbackvalidation": { "feedback_id_1": { "language_coderequired": "feedback-1Yes" }, } } "feedback_id_2": { }, "language_code": "feedback-2" "responseDeclaration": { } }, "solutionsresponse1": { "language_code": [ "cardinality": "single", { "idtype": "bc6e4294-1a19-4e75-fb43-871f0e54b0e8integer", "typecorrectResponse": "html",{ "value": "solution in HTML format"3 }, { "mapping": [ "id": "bc6e4294-1a19-4e75-fb43-871f0e54b0e9", { "type": "html", "value": "a2, question can have more than one solution. in such cases, another solution in HTML format" "score": 0.5 } ] }, "interactions": { "response1": { "type": "choice", "optionsvalue": [1, { "label"score": {0.25 "language_code": "<p>Floral organs</p>" } }, ] "value": 0} }, "outcomeDeclaration": { "labelmaxScore": { "language_codecardinality": "<p>Veinssingle", and veinlets in a lamina</p>" "type": "integer", }, "valuedefaultValue": 3 1 } ] } }, "validationobjectType": {"Question", "requiredroot": false, "Yes" "isNew": true } }, } "hierarchy": { } } |
Response:
Code Block | ||
---|---|---|
| ||
"questionset_identifier": { "id": "api.question.create", "verchildren": "5.0",[ "ts": "2023-01-30T19:43:43ZZ", "paramsq1": { "resmsgid": "ca1ed6b6-994d-487c-8ecd-0ca164a84c94", ], "msgidroot": null,true } "err": null, } "status": "successful", } } } |
Sample Input Request with multi-language attributes (default format):
Code Block | ||
---|---|---|
| ||
{ "errmsgrequest": null{ }, "responseCode"data": "OK",{ "resultnodesModified": { "identifierq1": "do_2137224832856555521270",{ "versionKey": "1675107822985" } } |
Question Read API:
Request:
Code Block |
---|
curl --location --request GET 'https://dev.inquiry.sunbird.org/api/question/v2/read/do_213688205764337664161?mode=edit&fields=answer,instructions' \
--header 'Authorization: {{api_key_new}}' |
Response:
question read api will always return will data in below format:
Code Block | ||
---|---|---|
| ||
{ "id": "api.question.read", "ver": "5.0", "ts": "2023-01-30T03:28:23ZZ", "params": {metadata": { "name": "Name of the question", "code": "q1", "mimeType": "application/vnd.sunbird.question", "resmsgidprimaryCategory": "db23eb9e-207c-488c-a45a-7da36a2084eeMultiple Choice Question", "msgid": null, "errinteractionTypes": [ null, "status": "successful", "errmsgchoice": null }, "responseCode": "OK", "result": { ], "question": { "identifierqumlVersion": "do_213688205764337664161"1.1, "body": { "media": "language_code_1": "question body as string in specified language."[ },{ "instructions": { "language_codeid": "do_2137498365362995201237"instructions, in HTML format." }, "answertype": {"image", "language_code": "answer in specified language" }"src": "/assets/public/content/assets/do_2137498365362995201237/tea.jpeg", "hints": { "language_codebaseUrl": [ "https://dev.inquiry.sunbird.org" "hint-1", } "hint-2" ], }, "feedbackbody": { "feedback_id_1": { "language_code": "feedback<div class='question-body' tabindex='-1" }, "feedback_id_2": { "language_code": "feedback-2'><div class='mcq-title' tabindex='0'><p><span style=\"background-color:#ffffff;color:#202124;\">Which of the following crops is a commercial crop?</span></p></div><div data-choice-interaction='response1' class='mcq-vertical'></div></div>" } }, "solutions": { "language_codeanswer": [{ { "id"language_code": "bc6e4294-1a19-4e75-fb43-871f0e54b0e8", "type": "html",<p>Barley</p>" }, "value": "solution in HTML format" "instructions": { }, { "language_code": "<div>...</div>" "id": "bc6e4294-1a19-4e75-fb43-871f0e54b0e9" }, "typehints": "html", { "valuehint_1": "a{ question can have more than one solution. in such cases, another solution in HTML format" "language_code": "<div>...</div>" } }, ] }, "interactionshint_2": { "response1": { "typelanguage_code": "choice",<div>...</div>" "options": [ } { }, "labelfeedback": { "languagefeedback_code1": "<p>Floral organs</p>"{ }, "value": 0 "language_code": "<div>...</div>" }, { "label"feedback_2": { "language_code": "<p>Veins and veinlets in a lamina</p>" "<div>...</div>" } }, "valuesolutions": 1{ } "solution_1": { ] },"language_code": "<div>...</div>" "validation": { }, "required": "Yes" }"solution_2": { } } } } |
the read api transforms data created using v1 api’s or spec-1 of v2 api’s. It injects default language code configured in the system and return the response to user.
same transformation will be applicable in Question List API
Question Update API:
Question Update API also support both spec as mentioned in create api.
For older data (created with v1 api’s), on v2 api update call, data will be migrated to v2 api format as well as version will be set to 2.
Request_1:
Code Block | ||
---|---|---|
| ||
{ "request": { "question": { "language_code": "<div>...</div>" } "name": "updated_question_title", }, "versionKey": "1234", "bodyinteractions": { "question body as string when question can be used in only one language.","response1": { "instructions": { "language_codetype": "instructionschoice", in HTML format." }, "answeroptions": "answer",[ "hints": [ "hint-1", { "hint-2" ], "feedbacklabel": { "feedback_id_1": "feedback-1", "feedbacklanguage_id_2code": "feedback-2"<p>Wheat</p>" }, "solutions": [}, { "idvalue": "bc6e4294-1a19-4e75-fb43-871f0e54b0e8", 1 "type": "html", }, "value": "solution in HTML format" { }, { "idlabel": "bc6e4294-1a19-4e75-fb43-871f0e54b0e9",{ "type": "html", "valuelanguage_code": "a question can have more than one solution. in such cases, another solution in HTML format" <p>Barley</p>" }, } ], "interactionsvalue": { 2 "response1": { "type": "choice" }, "options": [ { { "label": "<p>Floral organs</p>",{ "valuelanguage_code": 0 "<p>Maize</p>" }, { "value": 3 "label": "<p>Veins and veinlets in a lamina</p>", }, "value": 1 { } ] "label": { }, "validation": { "requiredlanguage_code": "Yes<p>Tea</p>" } } }, } } |
Request_2:
Code Block | ||
---|---|---|
| ||
{ "request": { "question": { "namevalue": "updated_question_title", 4 "versionKey": "1234", } "body": { "language_code_1": "question body as string], in specified language." }, "instructionsvalidation": { "language_code": "instructions in HTML format." "required": "Yes" }, "answer": { } "language_code": "answer in specified language" }, } "hints": { "language_code": [}, "hint-1responseDeclaration",: { "hint-2" "response1": { ] }, "feedbackcardinality": {"single", "feedback_id_1": { "language_code"type": "feedback-1integer", }, "feedback_id_2correctResponse": { "language_code "value": 3 "feedback-2" } }, "solutions": { "language_codemapping": [ { { "id": "bc6e4294-1a19-4e75-fb43-871f0e54b0e8", "typevalue": "html"2, "value": "solution in HTML format" "score": 0.5 }, { }, "id": "bc6e4294-1a19-4e75-fb43-871f0e54b0e9", { "type": "html", "value": 1, "a question can have more than one solution. in such cases, another solution in HTML format" "score": 0.25 } ] } }, "interactions": { ] "response1": { } "type": "choice", "options": [}, "outcomeDeclaration": { "labelmaxScore": { "language_codecardinality": "single"<p>Floral organs</p>", },"type": "integer", "valuedefaultValue": 03 }, {} }, "label": { "objectType": "Question", "language_coderoot": "<p>Veinsfalse, and veinlets in a lamina</p>" "isNew": true }, }, "valuehierarchy": 1{ "questionset_identifier": { } "children": [ ] "q1" }, "validation": { ], "requiredroot": "Yes"true } } } } } |
Sample Success Response:
Code Block | ||
---|---|---|
| ||
{ "id": "api.questionquestionset.hierarchy.update", "ver": "5.0", "ts": "2023-0105-30T1908T07:4303:43ZZ25ZZ", "params": { "resmsgid": "ca1ed6b6deb89409-994d5775-487c4970-8ecd921d-0ca164a84c941298f99dafa7", "msgid": null, "err": null, "status": "successful", "errmsg": null }, "responseCode": "OK", "result": { "identifier": "do_213722483285655552127021379147288621056013168", "versionKeyidentifiers": "1675107822985" } } |
Question Review API & Question Retire API:
there is no change in spec from v1 to v2 api.
there is no change for logical behaviour of the api
Question Publish API:
there is no change in spec from v1 to v2 api.
For older data, the api will throw client error if the data version is 1.
Question Copy API:
there is no change in spec from v1 to v2 api.
if source object version is 1, copied data will be created using v2 format.
QuestionSet API’s:
QuestionSet Create API:
there is no change in spec from v1 to v2 api.
for instructions metadata, editor need to send specific language code in the data.
if language code is not supplied, default language code will be injected at platform level.
...
{
"q1": "do_21379147288888115213169"
}
}
} |
data transformation will be done for questions data supplied in single language under request.
if question data is provided without language information, default language will be stamped.
QuestionSet Update API:
there is no change in spec from v1 to v2 api.
QuestionSet Read Hierarchy API:
there is no change in spec from v1 to v2 api.
...
For older questionset having qumlVersion 1.0, v2 api will auto migrate to quml spec 1.1.
QuestionSet Review API:
there is no change in spec from v1 to v2 api.
For older data transformation will be done for questions data supplied under request.
if question data is provided without language information, default language will be stamped.
...
, the api will throw client error if the object qumlVersion is 1.0.
All children should belong to same qumlVersion as per Questionset. ????
QuestionSet Publish API:
there is no change in spec from v1 to v2 api.
...
For older data, the api will throw client error if the object qumlVersion is 1.0.
QuestionSet Retire API:
there is no change in spec from v1 to v2 api.
there is no change for logical behaviour of the api
QuestionSet Publish Copy API:
there is no change in spec from v1 to v2 api.
the api will support copy operation only if object qumlVersion match with default qumlVersion supported by the micro-service.
For older data, the api will throw client error if the data version qumlVersion is 1.
QuestionSet Copy API:
there is no change in spec from v1 to v2 api.
if source object version is 1, copied data will be created with version 20. First the data should be migrated.