AnsweredAssumed Answered

`bucket` parameter in Assignments endpoint

Question asked by Brian Bennett on Dec 3, 2019
Latest reply on Dec 4, 2019 by Brian Bennett

I'm working on creating a custom report which pulls users from a course and lists the number of missing assignments along with the total assignments in the course. The `bucket` param in the API docs lists 'unsbumitted' as an acceptable parameter, but when request that list, I get an empty response.

 

When looking at my test account, the test student has unsubmitted assingments, so I'm wondering if A) anyone else can confirm this issue, and B) is there a better way to pull this report together?

 

Here's a sample script using the Python `canvasapi` library.

from canvasapi import Canvas

canvas = Canvas(PROD_URL, PROD_KEY)

course = canvas.get_course(12345)

# Just need the total number of assignments, details don't matter
assignments = len(list(siop.get_assignments()))

user = canvas.get_user(98765)
missing = user.get_assignments(course.id, bucket="future") # returns empty

# Calling without the bucket returns all assignments, so it works
# missing = user.get_assignments(course.id)

for item in missing:
    print(item.name)

Would it be better to call the assignments list and include `submissions` and then compare with a student list? That should work, but given that this endpoint is available, it would save some trouble with nested loops.

Outcomes