Moving to next segment via external tool
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2021
12:38 AM
Hi!
Is there a way to programmatically move to the next segment after finishing an exercise in the external tool (triggered after doing a grade pass back on the current exercise)? Or like create a button that functions like the Next Button below.
Solved! Go to Solution.
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2021
11:57 PM
I had to use the API
https://canvas.instructure.com/doc/api/modules.html#method.context_module_items_api.item_sequence
Just need to provide the canvas CourseId and moduleItemId
curl https://<canvas>/api/v1/courses/<course_id>/module_item_sequence?asset_type=Assignment&asset_id=123 \
-H 'Authorization: Bearer <token>'
then from the result get the html_url property of the next object inside the items.
Then use that to change the parent window location... canvas won't block this because you are changing the current page.
top.window.location.href = html_url ;
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.