Thank you for linking that documentation @vgayraud, those are the same sections of the API documentation we had reviewed ourselves so it is good to see we are in the right place.
Looking at the Scoring Definition schema, it appears to only let you define the scoring category and category group (plus some other variables) but it does not show that you can specify the numerical value to give to each answer choice for Scoring.
Have we missed something here or misinterpreted how to use the scoring object? If you have an example that would be greatly appreciated!
I suggest you build a simple survey and either export the qsf or get it with the Get Survey API to provide you with an example. You’ll want to look for GradingData in the questions definition. You should see something similar to this that should help you build what you want :
"GradingData": :
{
"ChoiceID": "1",
"Grades": {
"SC_0lHL6Wk3TbESpWC": "10",
"SC_cV07JqyAmSIIS1g": "1"
},
"index": 0
},
{
"ChoiceID": "3",
"Grades": {
"SC_0lHL6Wk3TbESpWC": "30",
"SC_cV07JqyAmSIIS1g": "3"
},
"index": 1
},
{
"ChoiceID": "2",
"Grades": {
"SC_0lHL6Wk3TbESpWC": "20",
"SC_cV07JqyAmSIIS1g": "2"
},
"index": 2
}
]
}
Tested this myself and wanted to add some additional notes to save future readers some time:
The ‘SC_01HL...’ and ‘SC_cV07...’ strings within ‘Grades’ in @vgayraud’s screenshot are scoring category ID’s. I was confused by this at first but If you have used the UI before, you will know that you have to have at least one scoring category before you can start assigning point values to answer choices.
The default UI name is “Score” but it will have a scoring category ID tied to it as well, similar to those in the screenshot. I created a question and gave it Score values manually through the UI, then used the Get Questions API call to extract my scoring category ID (each question will have the same ‘GradingData’ piece in the response as well).
Note: If you are building an exam from scratch with the API, you can define your scoring category when you first define the survey using the survey definition and scoring definition schemas (links to the documentation for those schemas are in @vgayraud’s first response).
Finally, to add answer choice point values with the API, you can insert the ‘GradingData’ Key + value as shown in the screenshot (or captured by your Get Questions API response) into the body of your Create Question post request. You just need to ensure the scoring category ID matches that of an existing scoring category for it to work.
Note: I was not able to find ‘GradingData’ anywhere in the Qualtrics API, neither as an option for the Create Question post request body message, nor as a schema like the scoring definitions schema. I was, however, able to successfully add it to the Create Question Post request just like the other body message options, and validated that it worked by going on the UI and seeing the new question with the uploaded answer choice point values.
Hope this adds some clarity
@r2rajcic Kudos to you for really dive deep into this. I have a silly question, I can’t find scoring ID in the https://api.qualtrics.com/957c5f8a4604b-get-questions API. Can you clarified more about that part.
@dxconnamnguyen Definitely not a silly question. What I have learned is that the documentation is not all inclusive, but basically if it exists in the QSF representation of the question, then the GET and POST requests from the question API can handle it.
I tried explaining below, but you can probably figure this out just as quickly by experimenting with an example survey where you call Get Questions before adding scoring, then again after adding Scoring + assigning point values with the UI, then one more time after adding a new scoring category also with point values (you should look for “GradingData” in the response each time (hint, it won’t show up until scoring is defined)).
Here is my explanation as I have come to understand it (disclaimer: I am not a Qualtrics expert nor claim to be):
The ‘scoring category id’ variable I am talking about is actually defined in the Scoring definition schema under ScoringCategories > “ID”.
That variable then shows up in the QSF response from the Get Questions API call under the “GradingData” object/element/whatever you want to call it. So you actually want to be looking for “GradingData” if you are calling Get Questions, not the ScoringCategories “ID” variable.
Unfortunately, “GradingData” is not found in the documentation for the Get Questions API call, but if it was it would show up under Responses 200 > Body > result > elements > “GradingData” and it would say it is an ‘arraygobject]’ where each object looks like:
{
“ChoiceID”: “your_answer_choice_ID_string_used_as_the_key_in_the_Choices object”,
“Grades”: {“ID”: “answer_choice_points_value_as_string_used_for_this_scoring_category”},
“index”: an_integer_index_used_for_ordering_(starts_at_0)
}
Just looking at “Grades” we can tell that GradingData essentially stores for each answer choice:
- the answer choice points value
- the scoring category that those points should belong to if the answer choice is selected.
(think of scoring categories as sets of answer choices who’s points get summed together if they are selected. In the screenshot, each answer choice belongs to two different scoring categories and has a different value that would contribute to the category sum).
Lastly, because “GradingData” does exist as an element in the Get Questions API response, we know it can also be used in the Create Questions request, even though it is not directly documented.