Celebrate Excellence in Education: Nominate Outstanding Educators by April 15!
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.
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...
While you wait for an answer, is it possible to reverse the list yourself?
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...
Thanks. I would like to sort it through the API as there can be 100s of assignments(potentially) and I would like to only get the 10 most recent. I know it's possible through code but the concern here is the number of API calls then to get all the assignments.
To participate in the Instructure Community, you need to sign up or log in:
Sign In
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.