Assignments API Call: List Assignments in descending order of creation/due date or most recent

Jump to solution
MyDestinyAdmin
Community Member

Hi,

I would like to get a list of assignments sorted by their creation_at or due_date in descending order(most recent assignments). On https://canvas.instructure.com/doc/api/assignments.html#method.assignments_api.index  , I can see an order_by which only accepted position, name, and due_at but doesn't specify an order_direction. Could someone please help me with this?

Thanks in advance! 

Labels (1)
0 Likes
1 Solution
jerry_nguyen
Community Contributor

@MyDestinyAdmin 

No, you can't change the order. I had a look at the source code of the API endpoint and it's set as latest_due_date order.

You will need to go write a loop to go through the array, here is an example in Javascript (https://stackoverflow.com/questions/10123953/how-to-sort-an-object-array-by-date-property)

Alternatively, you can do it visually through @James 's spreadsheet here https://community.canvaslms.com/t5/Higher-Ed-Canvas-Users/Adjust-All-Assignment-Dates-on-One-Page/ba...

 

 

View solution in original post