Assignments API Call: List Assignments in descending order of creation/due date or most recent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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...
This discussion post is outdated and has been archived. Please use the Community question forums and official documentation for the most current and accurate information.