cancel
Showing results for 
Search instead for 
Did you mean: 
Community Member

Canvas REST API: getting answer id's

Jump to solution

In the REST API multiple choice questions have responses that are labeled with answer id's. To get at them, I'm going through a very circuitous path. First I get course submissions from a student that has actually taken the quiz/survey. Then I look at the submission_history, and then submission_data. Now I have a response that contains the question id. With that question id (and the quiz id) I can then query a single quiz question. The response contains an "answers" array. The answer array contains pairs of answer ids and the corresponding text.

This is quite inefficient but I can't seem to find out a more direct way of getting at the answer id <-> text mapping. Does anyone know of a more direct way?

Thanks,

Josh

Tags (1)
1 Solution

Accepted Solutions
Surveyor

Hi Josh,

Normally, the API you are looking for is this one (Quiz Questions - Canvas LMS REST API Documentation). The weight of correct answer will be 100. However, if the quiz is created by drawing questions from a question bank, you would get nothing from the API response. Then you have to go through the submission's route.

Best,

Mu

View solution in original post

3 Replies
Community Team
Community Team

Hello, josh@ucsc.edu Welcome (a bit belatedly) to the Canvas Community! Due to the technical nature of this question, I've shared it with the https://community.canvaslms.com/groups/canvas-developers?sr=search&searchId=2e489bde-e779-466e-9146-...‌ group. Their responses will appear here in a unified thread, but if you'd also like to join the group, you can do so by clicking on the link to the group and selecting Join Group from the Actions dropdown at the upper right of the page.

Surveyor

Hi Josh,

Normally, the API you are looking for is this one (Quiz Questions - Canvas LMS REST API Documentation). The weight of correct answer will be 100. However, if the quiz is created by drawing questions from a question bank, you would get nothing from the API response. Then you have to go through the submission's route.

Best,

Mu

View solution in original post

Community Member

Thanks Mu,

I tried going that route and did find that I could get out the answer id's that way. I can't see that documented in the API so your input was really helpful!

Josh