tl-its-umich-edu / canvas-lti-updater

Script to update Canvas LTI
0 stars 0 forks source link

generalize tool as Canvas API CLI #1

Open lsloan opened 4 years ago

lsloan commented 4 years ago

As @jonespm mentioned, the current program is for a specific purpose and is hard-coded to look for values relating to M-Write Peer Review. I think this tool should be generalized to provide tools more like single-purpose shell utilities. A CLI for Canvas, similar in spirit to the oc tool for OpenShift.

That is, one program that can call several single-purpose modules.

For example, if the CLI were named cnvs, a session could look like…

cnvs login 'https://Canvas_API_URL' --key='Canvas_API_key'
cnvs get tool --courseid='123456, 234567' > course_ltis.json
# call jq or other program to find LTIs in "course_ltis.json" that need update
cnvs delete tool --id="$(cat lti_ids.txt)" # "lti_ids.txt" would contain CSV list of tool IDs
cnvs create tool --course_id="$(cat course_ids.txt)" --tool_xml='lti_config_prod.xml' --tool_key='tool_key' --tool_secret='tool secret' > new_course_ltis.json # "course_ids.txt" would contain CSV list of course IDs
# call jq or other program to find new LTI info
cnvs get assignment --courseid='123456, 234567' > course_assignments.json
# call jq or other program to find assignments in "course_assignments.json" that need update
cnvs edit assignment --edits='assignment_edits.json' # "assignment_edits.json" would contain JSON with IDs of assignments to edit and properties to be set
jonespm commented 4 years ago

Talking to @ssciolla about this yesterday, many of the things features and researched as part of this could also be useful as part of a future CCM tool if one were developed.