Last active
July 27, 2018 22:17
-
-
Save acbart/23507c18723b62253734 to your computer and use it in GitHub Desktop.
Snippet to modify an external tool on Canvas via JS.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Query to GET a list of external tools, filter it for your tool, and then PUT it's changes | |
// Need to change the <course_id>, add your filtering criteria, and | |
// customize your data attributes for the tool. | |
$.get('https://canvas.instructure.com/api/v1/courses/<course_id>/external_tools/', {}, function(result) { | |
$.each(data, function(i, item) { | |
if (item /* matches some criteria, maybe the name? */) { | |
$.ajax({ url: 'https://canvas.instructure.com/api/v1/courses/<course_id>/external_tools/'+item.id, | |
type: 'put', | |
data: {'course_navigation[enabled]': 'true', | |
'user_navigation[text]': 'Something Cool', | |
'user_navigation[url]': 'https://example.com/ims/lti/user_endpoint'} | |
}) | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment