Endpoint:
POST
https://scorpion.caveon.com/api/exams/<exam_id>/items
To begin, here is the example JSON body we will be using for the POST call to create the item in Scorpion:
{
"name": "Item.Name.002",
"meta": {
"scorpion": {
"150bb6e6-aadc-4b84-a6f4-fa9a96e97d89": "682a0efe-af73-43dd-a4f1-33655674e278",
"92c87df6-f4bd-4dd7-a4fc-4ba21f9d9c51": 1,
"d0440933-d72e-4da0-b16b-dad5c43f6a7f": "58c58d23-6a60-4992-94a1-2757d7042b0a",
"e592394e-7a47-44df-9a00-d2c833533f57": "1ad402b8-63bb-4bee-8840-0f3be31cd731"
}},
"enemy_ids": [],
"content": {
"options": [
"key",
"dis 1",
"dis 2",
"dis 3"
],
"shared": [],
"stem": "This is where the question text goes. Choose the key to get this correct.",
"widgets": []
},
"settings": {
"cutscore_min": null,
"distractors_to_present": null,
"key": [
1,
0,
0,
0
],
"keys_to_present": null,
"points": 1,
"presentation_order": "random",
"scoring": "default",
"select_all_that_apply": false,
"selection_limit": null,
"type": "multiple_choice",
"weights": [
0,
0,
0,
0
]
},
"set_smartitem_id": false,
"feedback": {
"stem": ""
}
}
NOTE: The order of key:value pairs, objects, and arrays in the above JSON body is required as seen above.
The JSON body above contains the “meta” > “scorpion” object. This object contains a series of UID (Unique ID) key:value pairs:
The first UID (blue) maps to the Custom Field name specific to the Scorpion Exam Project you’re working in. The second UID (orange) maps to the value selected for that Custom Field.
In order to make the POST call to create the item, you’ll need to establish the mapping of those UIDs to their values ahead of time. To do that, you’ll start with this endpoint:
GET
https://scorpion.caveon.com/api/exams/<exam_id>?only=meta
In the return for that GET request, you’ll see all the available custom fields in the same order as they are entered in the Scorpion Exam Project user interface in the “custom_field_order” array:
In this example, those UUIDs map to the list of custom fields in the Settings > Custom Fields menu in the Scorpion Exam project user interface here:
So, the UID “d0440933-d72e-4da0-b16b-dad5c43f6a7f” maps to the custom field named “Objective” because it’s in the third position in both the “custom_field_order” array and in the Scorpion Exam Project user interface above.
You can also map the name of the Custom Field to its UID via the “custom” object in the return for your GET request here:
In the above screenshot, you’ll notice an “option_order” array that contains a series of UIDs. Those UIDs map to the available dropdown values for that specific custom field in order.
To use the “Objective” custom field as an example again, here would be the mapping for the first 3 option values of the “Objective” custom field in this project:
"d31a2a2f-1f45-416c-bb22-a1cf3fdd8d3a" = Arts & Leisure | Literature
"58c58d23-6a60-4992-94a1-2757d7042b0a" = Arts & Leisure | Music
”f81d4da3-4d2d-447f-906c-06364e11dd9d" = Arts & Leisure | Visual Arts
This is shown in the Scorpion project user interface in the Settings > Custom Fields > Objective menu here:
In the Item Editor, the first three values for the “Objective” custom field look like this:
Using the GET request above will allow you to map all custom field UIDs and their value UIDs to the texts they correspond to in the user interface.
Once you’ve established that mapping, you’ll simply add the UIDs for the Custom Fieldnames and their corresponding values to the “meta” > “scorpion” object as illustrated in the JSON body of the POST call at the beginning of this article:
Custom Field Names:
Custom Field Values:
NOTE: the UID "92c87df6-f4bd-4dd7-a4fc-4ba21f9d9c51" has a value of “1”. That is because it is a custom field that only accepts numbers. You can just enter the number without any quotes for such custom fields.
The item that was generated by the POST call at the beginning of this article looks like this in the Scorpion Exam Project user interface:
Item Bank View:
Item Editor View:
Comments
0 comments
Article is closed for comments.