Showing results for 
Show  only  | Search instead for 
Did you mean: 
New Member

Canvas API - link outcomes with quizzes


I am trying to find a way through data returned by the API to link learning outcomes with quizzes, however based on the data returned by each of the APIs I have been unable to find it. Does anyone know if this is possible? Thanks. 

Labels (2)
0 Kudos
7 Replies
Community Champion

Do you want to make a new link to an outcome? Or see outcome results on a quiz?

In Canvas, you can link Outcomes to Question Banks (Classic Quiz), but I've never tried doing that. There isn't even an endpoint to put a question directly into a bank without pushing it to a quiz first. And given how many issues are associated with New Quizzes, I haven't even looked at attaching Outcomes there yet. 

With as much work as we've done on using Outcomes, it's better to use the UI to attach items to question banks and then use the Outcome endpoints to gather data for analysis rather than using the API to create/associate.

One of our groups here gets data from the data warehouse to create some reports.  They would like the data to be realtime, but the data supplied by the warehouse is two days old, so I'm attempting to write something to use the API to retrieve data.  There is a table in the warehouse (learning_outcome_question_result_fact) with the following fields:



I can retrieve all the data from the Course, Outcome, OutcomeResult, Quiz, QuizSubmission, and User API calls, but I cannot seem to find a link between the quiz results and the learning outcomes to duplicate what's contained in this table. I thought it might be the assignments through rubrics, but it looks like the rubrics assigned to the assignments don't have any outcomes attached to them.  The learning_outcome_question_result_fact does have this link, so I'm kind of stumped.

Community Champion

I think I'm following. I've never used Canvas Data to get our information, so I'm not sure what kind of aggregating they're doing.

Using the API, you can request a list of outcome results for a given user id. You can also specify an outcome_id if you want to limit it to one outcome. Neglecting to send an outcome_id will return all results for the given user_id.

The request returns an array of outcome_result objects with this structure:


'outcome_results': [
                    'hidden': False,
                    'hide_points': False,
                    'id': 200559,
                    'links': {
                        'alignment': 'assignment_259284',
                        'assignment': 'assignment_259284',
                        'learning_outcome': '16987',
                        'user': '31871'
                    'mastery': True,
                    'percent': 0.75,
                    'possible': 4.0,
                    'score': 3.0,
                    'submitted_or_assessed_at': '2021-03-04T17:46:29Z'


To match the outcome to the assignment, you need to use outcome_result['links']['alignment'], which is the assignment ID. This is course-bound, so you'll need to request it within the course context (same course ID).

For quizzes, it aggregates attempts on questions linked to that outcome and I don't know of a way to get a per question report, mainly because outcomes have calculated scores. If a student gets a question wrong on an item with Outcome 1, what score do they get? There's no way to do that on the rubric scale the Outcome is attached to. That's why I look at the assessment as a whole and compare the quiz/assignments core (raw points) with their outcome performance (mastery vs non-mastery) and explore discrepancies.

Thanks, this was helpful. I have one follow up - you said that the API retrieves outcome results for the user, but the API call specifies the course as a parameter. Did you just mean the results are returned with the user in the result set, or is there another call that I didn't see in the documentation?
Community Champion

It's all within the course context, so no, you didn't miss anything. You can pass in a user ID to get their results in a course. If you omit that ID, it will give you results for all users in that course.

Well, this is interesting. Using this call GET /api/v1/courses/:course_id/quizzes/:id will return a course that is not returned by GET /api/v1/courses/:course_id/quizzes, using the same course_id. I am accounting for pagination. Any idea what might be going on?

New Quizzes are not returned by the /quizzes endpoint because they're classified as assignments. So, if you have a New Quiz you want the get the data from, you'll need to call courses/:course_id/assignments/:assignment_id to get those results.