Canvas Grades API

Jump to solution
FayeChli
Community Explorer

I would like to ask if there is an API endpoint (and where is its documentation) about fetching the final grades of courses. Was there any which is now deprecated? The only similar information i was able to find is at the "List your courses" endpoint where it seems one can include the "total_scores" property to be included in the response. Is that all?

Labels (2)
0 Likes
2 Solutions
chriscas
Community Coach
Community Coach

Hi @FayeChli,

I know one way is the Courses -> List Users in Course with the include[] parameter set to enrollments.  According to the documentation, this would: "Optionally include with each Course the user’s current and invited enrollments. If the user is enrolled as a student, and the account has permission to manage or view all grades, each enrollment will include a ‘grades’ key with ‘current_score’, ‘final_score’, ‘current_grade’ and ‘final_grade’ values."

Let us know if this gets you what you need!

-Chris

View solution in original post

James
Community Champion

@FayeChli 

The main thing is that it comes from enrollments. That means that anywhere you can fetch enrollments is a good place to look for the information. I personally use the List enrollments endpoint of the Enrollments API. I set the types[]=StudentEnrollment and state[]=active to reduce the amount of information sent. Those would vary depending on your requirements.

You can also get information from the GraphQL interface. In general, it is faster than the REST API, especially since the enrollments endpoint is relatively expensive. You could do something like this (change the 1234 to your course ID). Go to your main instance and put /graphiql to test this. Then you can automate it with the REST API.

query finalGrades {
  course(id: "1234") {
    enrollmentsConnection(filter: {states: active, types: StudentEnrollment}) {
      nodes {
        grades {
          finalScore
        }
        user {
          _id
          sisId
          sortableName
        }
      }
    }
  }
}

 

View solution in original post