Forum Discussion
Query Forms API to get scores or results from form submission
Hello All,
May be one for the Forms/Dev Community but thought I would try here. We have a process where 4 forms are submitted weekly (Every week has 4 new forms). We currently gather responses into a SPO list and feed that in PowerBI.
A new requirement has come in that the forms (which are quizzes) also need to push the scores to SPO. We have done this with conditionals to check the text of the correct answers but the workload for this is unmanageable. I know there is a forms Api (undocumented) and we have successfully queried it to get the quiz questions, but these doesn't seem to be any info in there about the right answer.
My question is, is it possible to query the forms API to get the response points, either total or per question?
Included is the starting point, just need to know if anyone knows the URI to get what we need.
- DingkunXieMicrosoft
Use below API to get the form definition which contains the answer and points information per question -
GET https://forms.office.com/formapi/api/{TenantId}/users/{UserId}/light/forms('FormId')?$select=id,order,otherInfo,questions($expand=choices)
e.g.,
"questionInfo": "{\"Choices\":[{\"Description\":\"Option 1\",\"IsGenerated\":true,\"IsAnswerKey\":true},{\"Description\":\"Option 2\",\"IsGenerated\":true,\"IsAnswerKey\":false}],\"ChoiceType\":1,\"AllowOtherAnswer\":false,\"OptionDisplayStyle\":\"ListAll\",\"ChoiceRestrictionType\":\"None\",\"ShowRatingLabel\":false,\"Point\":10}",
Use below API to get the aggregated results which contains responses and total score -
GET https://forms.office.com/formapi/api/{TenantId}/users/{UserId}/forms('FormId')/GetAggregateQuizData
e.g.,
"quizSummaryData": {
"averageScore": 10.0,
"averageSubmitTimeSeconds": 2.0,
"count": 1- jshaunBTCCopper ContributorWill this work for grabbing the score results when a person submits are response, or will only ever give aggregate results for everyone?
- DingkunXieMicrosoftIt will aggregate results for everyone, but you can filter by user name (email address) since the results contain that identifying information.
- DrEnnuiCopper Contributor
DingkunXie What is your source for this information?
- DingkunXieMicrosoftThis is how we implement it in our service.