Create/Update question
| Method |
Description |
| exam.questionCreate |
Create question. |
| exam.questionUpdate |
Update question. |
Request parameters
{
"question": {
"id": {QuestionId}, /* Only for update operation */
"exam_id": {ExamId},
"question": "{Question}",
"explanation": "{Explanation}",
"type": {Type},
"case_study_id": {CaseStudyId},
"external_id": "{ExternalId}",
"points": {QuestionPoints},
"properties": {QuestionProperties}
},
"answers": [
{
"old_id": "{OldId}",
"answer": "{Answer}",
"is_correct": {IsCorrect},
"order": {Order},
"points": {AnswerPoints}
},
...
],
"resources": {
"{ResourcePath}": "{ResourceCnt}",
...
}
}
Response parameters
{
"question": {
"id": {QuestionId},
"exam_id": {ExamId},
"question": "{Question}",
"explanation": "{Explanation}",
"type": {Type},
"case_study_id": {CaseStudyId},
"external_id": "{ExternalId}",
"properties": {QuestionProperties}
},
"answers": [
{
"id": {AnswerId},
"old_id": "{OldId}",
"answer": "{Answer}",
"is_correct": {IsCorrect},
"order": {Order}
},
...
],
"resources": {
"{ResourcePath}": "{NewResourcePath}",
...
},
"completed": {Comleted}
}
Every field in the "question" object below - not just the ones being changed - must be resent with its current (or new) value on every update call; any field left out is reset to empty, not preserved. The "answers" array works the same way at the question level: sending it fully replaces the existing answer set (existing answer ids are re-created unless {AnswerId} is provided per answer).
Parameters meaning
| Variable |
Type |
Appearance |
Description |
| question |
| {QuestionId} |
Integer |
Mandatory |
Question id. Mandatory for update operation. |
| {ExamId} |
Integer |
Mandatory |
Exam id. |
| {Question} |
String |
Mandatory |
Question content. HTML formatted, may contain media resources like images and audio. Please be aware that only relative URLs are allowed. See Rich HTML formatting for the full list of supported tags and attributes. Links and YouTube embeds are not available in this field. |
| {Explanation} |
String |
Optional |
Explanation content. HTML formatted, may contain media resources like images and audio. Please be aware that only relative URLs are allowed. See Rich HTML formatting for the full list of supported tags and attributes. |
| {Type} |
Integer |
Mandatory |
Type of the question. Following options are available:
- 1 - Single choice question. Selection of one answer represents correct question answer.
- 2 - Multiple choice question. Selection of several answers represents correct question answer.
- 3 - Drag & Drop question (image-based). The correct answer is defined by dragging each draggable block onto its matching target block.
- 4 - Point & Shoot question (image-based). The correct answer is set by placing one or more markers in the correct position.
- 5 - Hot Area (image-based). The correct answer is set by selecting one or more hot areas.
- 6 - Sort / Reorder question. Answer variants needs to be presented in the correct order.
- 7 - Text input question. The answer have to be typed manually and then will be compared with the reference.
|
| {CaseStudyId} |
Integer |
Optional |
Case study id. Reference to case study id. Question will be displayed together with referenced case study. |
| {ExternalId} |
String |
Optional |
External Id. Optional field to store external system question id, which later can be used for matching/synchronization. |
| {QuestionPoints} |
Integer |
Optional |
Number of points awarded for a correct answer to the question. Only affects the "points gained" evaluation methods (2 and 4, see exam.examCreate/examUpdate) - the "percent correct" methods (1 and 3) score by a plain count of fully-correct questions and ignore points entirely.
|
| {QuestionProperties} |
Object |
Optional |
Properties of the question. Valid properties vary by question type. Refer to the definitions below. |
| answers |
| answers |
Array |
Optional |
Array of answer options. Mandatory and must be non-empty for single/multiple choice (type 1/2) and Sort/Reorder (type 6) questions - omitting it, or sending an empty array, is rejected. Exactly one answer is technically accepted but returns a warning recommending at least two. |
| {AnswerId} |
Integer |
Mandatory |
Answer id. Optional in request. No need to provide it in request, all answer options will be re-created. |
| {OldId} |
Integer |
Optional |
Your answer id. State it if you want to get association of your answer id with newly created answer id. |
| {Answer} |
String |
Mandatory |
Answer content. HTML formatted, may contain media resources like images and audio. Please be aware that only relative URLs are allowed. See Rich HTML formatting for the full list of supported tags and attributes. Links and YouTube embeds are not available in this field. At least two answers are expected. |
| {IsCorrect} |
Boolean |
Optional |
Possible values true/false. Indicates whether the answer option is correct or no.
- Single choice question: only one answer option can be marked as correct.
- Multiple choice question: more than one correct answer is expected.
- Sort / Reorder question: every answer option must be marked correct (true), unless optional_answers is enabled (see Sort / Reorder questions properties below) - in that case, answer options that are not part of the correct sequence should be marked incorrect (false).
|
| {Order} |
Integer |
Mandatory |
Valid and mandatory for Sort / Reorder question type, for every answer option - including answer options marked incorrect when optional_answers is enabled (their order value is required but not used for sequence checking). Indicates the correct sequence order of the answer option; must be unique across the answer set.
|
| {AnswerPoints} |
Integer |
Optional |
Number of points awarded if the relevant answer option is selected. These points will be added to the question points. Only affects the "points gained" evaluation methods (2 and 4) - see {QuestionPoints} above.
|
| resources |
| resources |
Object |
Optional |
If you are using media resources like images you need to send the content of each media resource under "resources" node. |
| {ResourcePath} |
String |
Mandatory |
Path of media resource. Same value as it was used in Description. Example: "image.jpg" for <img src="image.jpg">. |
| {ResourceCnt} |
String |
Mandatory |
Base64 encoded content of media resource. |
| {NewResourcePath} |
String |
Mandatory |
New media resource path. |
| response |
| {Completed} |
Boolean |
Mandatory |
Indicates whether action was successfully completed or not. |
Question properties for image-based questions
This section describes the properties for the following question types:
- 3 - Drag & Drop question.
- 4 - Point & Shoot question.
- 5 - Hot Area.
{
"image": {ResourcePath},
"areas": [
{
"id": {AreaId},
"x": {AreaXPos},
"y": {AreaYPos},
"width": {AreaWidth},
"height": {AreaHeight},
"type": {AreaType}
},
...
],
"options": {
"FixedWidth": {FixedWidth},
"FixedHeight": {FixedHeight},
"OneToOneMatching": {OneToOneMatching},
"SingleAnswer": {SingleAnswer}
},
"match": {
"{TargetAreaId}": {DraggableAreaId},
...
},
"correct": {
"{AreaId}": {IsCorrectArea},
...
}
}
Additional properties for:
- 3 - Drag & Drop question.
"points": {
"{TargetAreaId}": {
"{DraggableAreaId}": {AreaPoints},
...
}
...
}
Additional properties for:
- 4 - Point & Shoot question.
- 5 - Hot Area.
"points": {
"{AreaId}": {AreaPoints},
...
}
| Property |
Type |
Appearance |
Description |
| image |
| {ResourcePath} |
String |
Mandatory |
The base image path. The image content must be provided in the resources node of the request. |
| areas |
| {AreaId} |
String |
Mandatory |
Identifies the area ID. Area IDs must comply with the following templates, depending on the question type - and, for Drag & Drop, on this same area's own {AreaType}:
- targ-N for a Drag & Drop target area ({AreaType}=1), drag-N for a Drag & Drop draggable area ({AreaType}=2).
- block-N for Point & Shoot and Hot Area questions.
Where N is a number from 1 to 999. Must be unique across all areas in this question.
|
| {AreaXPos} |
Integer |
Mandatory |
Specifies the horizontal position of the area (X-axis), in pixels. Cannot be negative. Together with {AreaWidth}, the area must stay within the base image's width. |
| {AreaYPos} |
Integer |
Mandatory |
Specifies the vertical position of the area (Y-axis), in pixels. Cannot be negative. Together with {AreaHeight}, the area must stay within the base image's height. |
| {AreaWidth} |
Integer |
Mandatory |
Specifies the width of the area, in pixels. Minimum 30. |
| {AreaHeight} |
Integer |
Mandatory |
Specifies the height of the area, in pixels. Minimum 15. |
| {AreaType} |
Integer |
Mandatory |
Applicable only to Drag & Drop questions. Specifies the type of the area:
- 1 - Target area.
- 2 - Draggable area.
|
| options |
| {FixedHeight} |
Boolean |
Mandatory |
Specifies whether all areas must have the same height. |
| {FixedWidth} |
Boolean |
Mandatory |
Specifies whether all areas must have the same width. |
| {OneToOneMatching} |
Boolean |
Mandatory |
Applicable only to Drag & Drop questions. Ensures that each draggable block can be matched with only one target block. |
| {SingleAnswer} |
Boolean |
Mandatory |
Applicable only to Point & Shoot and Hot Area questions. Ensures that only one block is marked as correct. |
| points |
| {AreaPoints} |
Integer |
Optional |
Number of points awarded for matching combination or selecting the area. These points will be added to the question points. |
| match |
| {TargetAreaId} |
String |
Mandatory |
Applicable only to Drag & Drop questions. Refers to the area ID of a target type and indicates that the specified target is matched with a specific draggable block. |
| {DraggableAreaId} |
String |
Mandatory |
Applicable only to Drag & Drop questions. Refers to the area ID of a draggable type and indicates that the specified target is matched with a specific draggable block. |
| correct |
| {IsCorrectArea} |
Boolean |
Mandatory |
Applicable only to Point & Shoot and Hot Area questions. Indicates whether the specified block is part of the correct answer. |
Sort / Reorder questions properties
{
"optional_answers": {OptionalAnswers}
}
| Property |
Type |
Appearance |
Description |
| {OptionalAnswers} |
Boolean |
Optional |
Default false.
- false (default): every answer option is part of the sequence - each one must be marked correct (is_correct=true) and given a unique order value.
- true: answer options that are not part of the correct sequence can be marked incorrect (is_correct=false) as distractors. Every answer option - distractors included - still requires a unique order value; it is simply not used for sequence checking on distractors.
|
Text input questions properties
{
"text_similarity": {TextSimilarity},
"case_sensitive": {CaseSensitive},
"text_answer": [
[
"value": "{TextAnswer}",
"points": {AnswerPoints},
],
...
],
}
| Property |
Type |
Appearance |
Description |
| {TextSimilarity} |
Integer |
Mandatory |
Text similarity percentage. Acceptable value range is 0-100. Mandatory for all text similarity question. |
| {CaseSensitive} |
Boolean |
Optional |
Indicates that uppercase (capital) and lowercase (small) letters are treated as different characters. For example, "Apple", "apple", and "APPLE" are all considered different values. |
| {TextAnswer} |
String |
Mandatory |
Correct answer for the question. Mandatory for all text input questions. Does not support HTML formatting. |
| {AnswerPoints} |
Integer |
Optional |
Number of points awarded if the relevant {TextAnswer} is entered. |