The Instructure Community will enter a read-only state on November 22, 2025 as we prepare to migrate to our new Community platform in early December.
Read our blog post for more info about this change.
Found this content helpful? Log in or sign up to leave a like!
Hello,
I am new to the API and DAP. Is there any easy way to calculate current marks for students?
It sounds simple but it looks like a complicated calculation, roughly the average of all required assignments mapped to a mark using the grading scheme for the section.
Is there a handy GitHub repo that I can leverage?
Thanks in advance!
Solved! Go to Solution.
It appears there is a grades property in the Enrollments endpoint: https://canvas.instructure.com/doc/api/enrollments.html
For each active enrollment you can get the final_score property from the grades collection.
I just tested this with the UCF Python wrapper library and it seems to work:
from canvasapi import Canvas
# Specify your Canvas instance and the API key of a user with grades viewing permissions
API_URL = <your_canvas_server_url>
API_KEY = <your_api_key>
# Create a Canvas object
canvas = Canvas(API_URL,API_KEY)
# Specify the course you want to query
course = canvas.get_course(<course_id>)
# Get all the active enrollments
enrollments = course.get_enrollments(type='StudentEnrollment',state='active')
# Iterate through all the enrollments and display name and grade
for e in enrollments:
print(e.user['sortable_name'] + ': ' + str(e.grades['final_score']))
It appears there is a grades property in the Enrollments endpoint: https://canvas.instructure.com/doc/api/enrollments.html
For each active enrollment you can get the final_score property from the grades collection.
I just tested this with the UCF Python wrapper library and it seems to work:
from canvasapi import Canvas
# Specify your Canvas instance and the API key of a user with grades viewing permissions
API_URL = <your_canvas_server_url>
API_KEY = <your_api_key>
# Create a Canvas object
canvas = Canvas(API_URL,API_KEY)
# Specify the course you want to query
course = canvas.get_course(<course_id>)
# Get all the active enrollments
enrollments = course.get_enrollments(type='StudentEnrollment',state='active')
# Iterate through all the enrollments and display name and grade
for e in enrollments:
print(e.user['sortable_name'] + ': ' + str(e.grades['final_score']))
Got it, yes that does work for me.
The final score isn't actually helpful, because our teachers use different grading schemes.
But when I look the the grades dictionary, I see everything I need:
{..., 'current_grade': 'B', 'current_score': 79.13, 'final_grade': 'B', 'final_score': 76.97, 'unposted_current_score': 79.13, 'unposted_current_grade': 'B', 'unposted_final_score': 76.97, 'unposted_final_grade': 'B'}
Community helpTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign inTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign in