{"id":21258526,"url":"https://github.com/ubc/jupyter-canvas-api","last_synced_at":"2026-04-05T08:34:00.857Z","repository":{"id":47050401,"uuid":"402916920","full_name":"ubc/jupyter-canvas-api","owner":"ubc","description":"An API to interact with the POC JupyterHub Cluster and Canvas for Instructors. ","archived":false,"fork":false,"pushed_at":"2024-10-29T15:54:34.000Z","size":19530,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-09-10T07:38:51.265Z","etag":null,"topics":["api","aws","flask","flocking","jupyter","kubernetes","python","rsync"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ubc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-03T23:05:54.000Z","updated_at":"2024-10-29T15:54:34.000Z","dependencies_parsed_at":"2023-01-23T09:16:05.975Z","dependency_job_id":"1d3176a1-7424-45d6-bb0b-1dff32fe6dfc","html_url":"https://github.com/ubc/jupyter-canvas-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ubc/jupyter-canvas-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ubc%2Fjupyter-canvas-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ubc%2Fjupyter-canvas-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ubc%2Fjupyter-canvas-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ubc%2Fjupyter-canvas-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ubc","download_url":"https://codeload.github.com/ubc/jupyter-canvas-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ubc%2Fjupyter-canvas-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31430009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T08:13:15.228Z","status":"ssl_error","status_checked_at":"2026-04-05T08:13:11.839Z","response_time":75,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","aws","flask","flocking","jupyter","kubernetes","python","rsync"],"created_at":"2024-11-21T04:09:23.902Z","updated_at":"2026-04-05T08:34:00.807Z","avatar_url":"https://github.com/ubc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Instructor API for the JupyterHub and Canvas Cluster POC\n\n## Description\n\nAn API to interact with the file system hosting the JupyterHub home directories. It allows Instructors to Snapshot their Students Home Drives for deadlines via an API call. These Snapshots can be triggered via an API call initiated from a Canvas Assignment deadline. Instructors can create multiple Snapshots with custom names for each student or sets of students. Instructors can retrieve the Snapshots via a ZIP file of the whole Snapshot or by specifying specific files within the Snapshot. Instructors can also Put grading reports into the Students Home Directory by an API call.\n\n\n### Headers \u0026 Post Variables\n\n\u003cdiv\u003e\n  \u003ctable\u003e\n    \u003cthead\u003e\n      \u003ctr\u003e\n        \u003cth\u003eName\u003c/th\u003e\n        \u003cth\u003eType\u003c/th\u003e\n        \u003cth\u003eDescription\u003c/th\u003e\n      \u003c/tr\u003e\n    \u003c/thead\u003e\n    \u003ctbody\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003cstrong\u003eX-Api-Key\u003c/strong\u003e\u003c/td\u003e\n        \u003ctd\u003eRequest Header\u003c/td\u003e\n        \u003ctd\u003eThis is a security header that allows users to interact with the API. Generally speaking this should be 16 to 32 characters long.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003cstrong\u003eSTUDENT_ID\u003c/strong\u003e\u003c/td\u003e\n        \u003ctd\u003ePost Request Variable\u003c/td\u003e\n        \u003ctd\u003eThis POST variable value represents a Student Canvas ID.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003cstrong\u003eSNAPSHOT_NAME\u003c/strong\u003e\u003c/td\u003e\n        \u003ctd\u003ePost Request Variable\u003c/td\u003e\n        \u003ctd\u003eThis POST variable value represents a name of a Snapshot\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003cstrong\u003eSNAPSHOT_FILENAME\u003c/strong\u003e\u003c/td\u003e\n        \u003ctd\u003ePost Request Variable\u003c/td\u003e\n        \u003ctd\u003eThis POST variable value represents the name of a file within a Snapshot.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003cstrong\u003eUPLOAD_FILE\u003c/strong\u003e\u003c/td\u003e\n        \u003ctd\u003eBinary Post Request Variable\u003c/td\u003e\n        \u003ctd\u003eThis Binary POST variable value contains the file being uploaded to the API.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003cstrong\u003eContent-Disposition\u003c/strong\u003e\u003c/td\u003e\n        \u003ctd\u003eResponse Header Variable \u0026 Data\u003c/td\u003e\n        \u003ctd\u003eThis Header response variable value contains the filename of file binary data being sent by the API. The request data contains the associated file binary data as an attachment.\u003c/td\u003e\n    \u003c/tr\u003e\n\u003c/table\u003e\n\n## API Examples\n\n### Get Snapshot List\n\nRetrieve a list of Snapshots for a specified Canvas student.\n\n##### API URI: https://{HOST}:{PORT}/get_snapshot_list\n\n##### API Return HTTP Codes:\n- *200* for Success with a POST Response,\n- *404* Failure Not Found with a POST Response.\n\n\n#### Required Headers \u0026 Post Variables:\n\n\u003ctable\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003cstrong\u003eX-Api-Key\u003c/strong\u003e\u003c/td\u003e\n        \u003ctd\u003eHeader Variable\u003c/td\u003e\n        \u003ctd\u003eThe API Key is Provided by UBC IT\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003cstrong\u003eSTUDENT_ID\u003c/strong\u003e\u003c/td\u003e\n        \u003ctd\u003ePost Variable\u003c/td\u003e\n        \u003ctd\u003eThe Student's Canvas ID\u003c/td\u003e\n    \u003c/tr\u003e\n\u003c/table\u003e\n\n#### Curl Command Call Examples:\n\n*In the following example(s) we will use HEADER variable __X-Api-Key__ with a value of '12345', and a __Student_ID__ POST variable with a value of '31387714', and a URL of __https://api.example.com:5000/get_snapshot_list__*\n\n1. curl -H \"X-Api-Key: 12345\" --data \"STUDENT_ID=31387714\" https://api.example.com:5000/get_snapshot_list\n2. curl -H \"X-Api-Key: 12345\" -d \"STUDENT_ID=31387714\" https://api.example.com:5000/get_snapshot_list\n3. curl -H \"X-Api-Key: 12345\" -F \"STUDENT_ID=31387714\" https://api.example.com:5000/get_snapshot_list\n\n\n```\nuser@host:~$  curl -H \"X-Api-Key: 1234567\" -d \"STUDENT_ID=31387714\" https://api.example.com:5000/get_snapshot_list\n[\"assignment-3_2021-09-09\",\"assignment-2_2021-09-09\",\"assignment-1_2021-09-09\",\"flocking-test-call_2021-09-09\",\"exam_work_2021-09-10\"]\nuser@host:~$\n```\n\n#\n\n### Get Snapshot File List\n\n\nRetrieve a list of files within the specified Canvas students' Snapshot.\n\n##### API URI: https://{HOST}:{PORT}/get_snapshot_file_list\n\n##### API Return HTTP Codes:\n- *200* Success with a POST Response\n- *406* Failure Missing Data, with a POST Response.\n- *404* Failure Not Found with a POST Response.\n\n#### Required Headers \u0026 Post Variables:\n\n\u003ctable\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003cstrong\u003eX-Api-Key\u003c/strong\u003e\u003c/td\u003e\n        \u003ctd\u003eHeader Variable\u003c/td\u003e\n        \u003ctd\u003eThe API Key is Provided by UBC IT\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003cstrong\u003eSTUDENT_ID\u003c/strong\u003e\u003c/td\u003e\n        \u003ctd\u003ePost Variable\u003c/td\u003e\n        \u003ctd\u003eThe Student's Canvas ID\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003cstrong\u003eSNAPSHOT_NAME\u003c/strong\u003e\u003c/td\u003e\n        \u003ctd\u003ePost Variable\u003c/td\u003e\n        \u003ctd\u003eThe Name of the Snapshot\u003c/td\u003e\n    \u003c/tr\u003e\n\u003c/table\u003e\n\n#### Curl Command Call Examples:\n\n*In the following example(s) we will use HEADER variable __X-Api-Key__ with a value of '12345', and a __Student_ID__ POST variable with a value of '31387714', a __SNAPSHOT_NAME__ POST variable with a value of 'assignment-1_2021-09-09', and a URL of __https://api.example.com:5000/get_snapshot_file_list__*\n\n\n1. curl -H \"X-Api-Key: 12345\" --data \"STUDENT_ID=31387714\u0026SNAPSHOT_NAME=assignment-1_2021-09-09\" https://api.example.com:5000/get_snapshot_file_list\n2. curl -H \"X-Api-Key: 12345\" -d \"STUDENT_ID=31387714\" -d \"SNAPSHOT_NAME=assignment-1_2021-09-09\" https://api.example.com:5000/get_snapshot_file_list\n3. curl -H \"X-Api-Key: 12345\" -F \"STUDENT_ID=31387714\" -F \"SNAPSHOT_NAME=assignment-1_2021-09-09\" https://api.example.com:5000/get_snapshot_file_list\n\n\n```\nuser@host:~$  curl -H \"X-Api-Key: 1234567\" -d \"STUDENT_ID=31387714\" -d \"SNAPSHOT_NAME=assignment-1_2021-09-09\" https://api.example.com:5000/get_snapshot_file_list\n[\"assignment-1.ipynb\",\"assignment-2.ipynb\",\"exercise-1.ipynb\",\"practice/practice-1.ipynb\",\"practice/practice-2.ipynb\",\"assignment-1-grades.html\"]\nuser@host:~$\n```\n\n#\n\n### Get Snapshot Zip File\n\nRetrieves a zip file of a students snapshot with the specified STUDENT_ID and SNAPSHOT_NAME Post headers.\n\n##### API URI: https://{HOST}:{PORT}/get_snapshot_zip\n\n##### API Return HTTP Codes:\n- *200* Success with a POST Response\n- *406* Failure Missing Data, with a POST Response.\n- *404* Failure Not Found with a POST Response.\n\n#### Required Headers \u0026 Post Variables:\n\n\u003ctable\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003cstrong\u003eX-Api-Key\u003c/strong\u003e\u003c/td\u003e\n        \u003ctd\u003eHeader Variable\u003c/td\u003e\n        \u003ctd\u003eThe API Key is Provided by UBC IT\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003cstrong\u003eSTUDENT_ID\u003c/strong\u003e\u003c/td\u003e\n        \u003ctd\u003ePost Variable\u003c/td\u003e\n        \u003ctd\u003eThe Student's Canvas ID\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003cstrong\u003eSNAPSHOT_NAME\u003c/strong\u003e\u003c/td\u003e\n        \u003ctd\u003ePost Variable\u003c/td\u003e\n        \u003ctd\u003eThe Name of the Snapshot\u003c/td\u003e\n    \u003c/tr\u003e\n\u003c/table\u003e\n\n\n#### Curl Command Call Examples:\n\n*In the following example(s) we will use HEADER variable __X-Api-Key__ with a value of '12345', and a __Student_ID__ POST variable with a value of '31387714', a __SNAPSHOT_NAME__ POST variable with a value of 'assignment-1_2021-09-09', and a URL of __https://api.example.com:5000/get_snapshot_zip__*\n\n1. curl -OJ -H \"X-Api-Key: 12345\" --data \"STUDENT_ID=31387714\u0026SNAPSHOT_NAME=assignment-1_2021-09-09\" https://api.example.com:5000/get_snapshot_zip\n2. curl -OJ -H \"X-Api-Key: 12345\" -d \"STUDENT_ID=31387714\" -d \"SNAPSHOT_NAME=assignment-1_2021-09-09\" https://api.example.com:5000/get_snapshot_zip\n3. curl -OJ -H \"X-Api-Key: 12345\" -F \"STUDENT_ID=31387714\" -F \"SNAPSHOT_NAME=assignment-1_2021-09-09\" https://api.example.com:5000/get_snapshot_zip\n\n\n```\nuser@host:~$  curl -OJ -H \"X-Api-Key: 12345\" -d \"STUDENT_ID=31387714\" -d \"SNAPSHOT_NAME=assignment-1_2021-09-09\" https://api.example.com:5000/get_snapshot_zip\ncurl: Saved to filename '31387714_assignment-1_2021-09-09.zip'\nuser@host:~$\n```\n\n\n#\n\n### Get Snapshot File\n\nRetrieves a Snapshot file of from a students snapshot with the specified STUDENT_ID SNAPSHOT_NAME, \u0026 SNAPSHOT_FILENAME Post headers.\n\n##### API URI: https://{HOST}:{PORT}/get_snapshot_file\n\n##### API Return HTTP Codes:\n- *200* Success with a POST Response\n- *406* Failure Missing Data, with a POST Response.\n- *404* Failure Not Found with a POST Response.\n\n\n#### Required Headers \u0026 Post Variables:\n\n\u003ctable\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003cstrong\u003eX-Api-Key\u003c/strong\u003e\u003c/td\u003e\n        \u003ctd\u003eHeader Variable\u003c/td\u003e\n        \u003ctd\u003eThe API Key is Provided by UBC IT\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003cstrong\u003eSTUDENT_ID\u003c/strong\u003e\u003c/td\u003e\n        \u003ctd\u003ePost Variable\u003c/td\u003e\n        \u003ctd\u003eThe Student's Canvas ID\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003cstrong\u003eSNAPSHOT_NAME\u003c/strong\u003e\u003c/td\u003e\n        \u003ctd\u003ePost Variable\u003c/td\u003e\n        \u003ctd\u003eThe Name of the Snapshot\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003cstrong\u003eSNAPSHOT_FILENAME\u003c/strong\u003e\u003c/td\u003e\n        \u003ctd\u003ePost Variable\u003c/td\u003e\n        \u003ctd\u003eThe Name and Location of the Snapshot file being downloaded\u003c/td\u003e\n    \u003c/tr\u003e\n\u003c/table\u003e\n\n#### Curl Command Call Examples:\n\n*In the following example(s) we will use HEADER variable __X-Api-Key__ with a value of '12345', and a __Student_ID__ POST variable with a value of '31387714', a __SNAPSHOT_NAME__ POST variable with a value of 'assignment-1_2021-09-09', a __SNAPSHOT_FILENAME__ Post variable with a value of 'practice/practice-1.ipynb', and a URL of __https://api.example.com:5000/get_snapshot_file__*\n\n1. curl -OJ -H \"X-Api-Key: 12345\" -d \"STUDENT_ID=31387714\" -d \"SNAPSHOT_NAME=12-08-2021\" -d \"SNAPSHOT_FILENAME=practice/practice-1.ipynb\" https://api.example.com:5000/get_snapshot_file\n2. curl -OJ -H \"X-Api-Key: 12345\" -F \"STUDENT_ID=31387714\" -F \"SNAPSHOT_NAME=12-08-2021\" -F \"SNAPSHOT_FILENAME=practice/practice-1.ipynb\" https://api.example.com:5000/get_snapshot_file\n3. curl -OJ -H \"X-Api-Key: 12345\" -d \"STUDENT_ID=31387714\u0026SNAPSHOT_NAME=12-08-2021\u0026SNAPSHOT_FILENAME=practice/practice-1.ipynb\" https://api.example.com:5000/get_snapshot_file\n4. curl -OJ -H \"X-Api-Key: 12345\" --data \"STUDENT_ID=31387714\u0026SNAPSHOT_NAME=12-08-2021\u0026SNAPSHOT_FILENAME=practice/practice-1.ipynb\" https://api.example.com:5000/get_snapshot_file\n\n\n```\nuser@host:~$  curl -OJ -H \"X-Api-Key: 12345\" -d \"STUDENT_ID=31387714\" -d \"SNAPSHOT_NAME=12-08-2021\" -d \"SNAPSHOT_FILENAME=practice/practice-1.ipynb\" https://api.example.com:5000/get_snapshot_file\ncurl: Saved to filename 'practice-1.ipynb'\nuser@host:~$\n```\n\n\n#\n\n### Upload File To Student Home Directory\n\nUpload a file to a students home directory with the specified STUDENT_ID SNAPSHOT_NAME Post Header, \u0026 an UPLOAD_FILE Binary Post header of a file. Can only upload files with .txt, .html, and .ipynb file extensions.\n\n##### API URI: https://{HOST}:{PORT}/put_student_report\n\n##### API Return HTTP Codes:\n- *200* Success with a POST Response\n- *406* Failure Missing Data, with a POST Response.\n- *404* Failure Not Found with a POST Response.\n- *417* Expectation Failed with a POST Response.\n\n\n#### Required Headers \u0026 Post Variables:\n\n\u003ctable\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003cstrong\u003eX-Api-Key\u003c/strong\u003e\u003c/td\u003e\n        \u003ctd\u003eHeader Variable\u003c/td\u003e\n        \u003ctd\u003eThe API Key is Provided by UBC IT\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003cstrong\u003eSTUDENT_ID\u003c/strong\u003e\u003c/td\u003e\n        \u003ctd\u003ePost Variable\u003c/td\u003e\n        \u003ctd\u003eThe Student's Canvas ID\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003cstrong\u003eUPLOAD_FILE\u003c/strong\u003e\u003c/td\u003e\n        \u003ctd\u003ePost Variable\u003c/td\u003e\n        \u003ctd\u003eThe location and file to be uploaded, preceded by an @ symbol\u003c/td\u003e\n    \u003c/tr\u003e\n\u003c/table\u003e\n\n#### Curl Command Call Examples:\n\n*In the following example(s) we will use HEADER variable __X-Api-Key__ with a value of '12345', and a __Student_ID__ POST variable with a value of '31387714', a POST variable called __UPLOAD_FILE__ with a binary value of a file '@/some/place/assignment-1-grades.html', and a URL of __https://api.example.com:5000/put_student_report__*\n\n1. curl -X POST -H \"X-Api-Key: 12345\" -F \"STUDENT_ID=31387714\" -F \"UPLOAD_FILE=@assignment-1-grades.html\" https://api.example.com:5000/put_student_report\n2. curl -X POST -H \"X-Api-Key: 12345\" -d \"STUDENT_ID=31387714\" -d \"UPLOAD_FILE=@assignment-1-grades.html\" https://api.example.com:5000/put_student_report\n3. curl -X POST -H \"X-Api-Key: 12345\" -data \"STUDENT_ID=31387714\u0026UPLOAD_FILE=@assignment-1-grades.html\" https://api.example.com:5000/put_student_report\n\n\n```\nuser@host:~$  curl -X POST -H \"X-Api-Key: 12345\" -F \"STUDENT_ID=31387714\" -F \"UPLOAD_FILE=@assignment-1-grades.html\" https://api.example.com:5000/put_student_report\nSuccess - File Uploaded - assignment-1-grades.html\nuser@host:~$\n```\n\n#\n\n### Create Snapshot for Student\n\n\n#### Required Headers \u0026 Post Variables:\n\n\u003ctable\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003cstrong\u003eX-Api-Key\u003c/strong\u003e\u003c/td\u003e\n        \u003ctd\u003eHeader Variable\u003c/td\u003e\n        \u003ctd\u003eThe API Key is Provided by UBC IT\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003cstrong\u003eSTUDENT_ID\u003c/strong\u003e\u003c/td\u003e\n        \u003ctd\u003ePost Variable\u003c/td\u003e\n        \u003ctd\u003eThe Student's Canvas ID\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u003cstrong\u003eSNAPSHOT_NAME\u003c/strong\u003e\u003c/td\u003e\n        \u003ctd\u003ePost Variable\u003c/td\u003e\n        \u003ctd\u003eThe Name of the Snapshot\u003c/td\u003e\n    \u003c/tr\u003e\n\u003c/table\u003e\n\n#### Curl Command Call Examples:\n\n*In the following example(s) we will use HEADER variable __X-Api-Key__ with a value of '12345', a __Student_ID__ POST variable with a value of '31387714',  a __SNAPSHOT_NAME__ POST variable with a value of 'Assignment-1', and a URL of __https://api.example.com:5000/snapshot__*\n\n1. curl -X POST -H \"X-Api-Key: 12345\" -F \"STUDENT_ID=31387714\" -F \"SNAPSHOT_NAME=Assignment-1\" https://api.example.com:5000/snapshot\n2. curl -X POST -H \"X-Api-Key: 12345\" -d \"STUDENT_ID=31387714\" -d \"SNAPSHOT_NAME=Assignment-1\" https://api.example.com:5000/snapshot\n3. curl -X POST -H \"X-Api-Key: 12345\" -data \"STUDENT_ID=31387714\u0026SNAPSHOT_NAME=Assignment-1\" https://api.example.com:5000/snapshot\n\n```\nuser@host:~$  curl -X POST -H \"X-Api-Key: 12345\" -data \"STUDENT_ID=31387714\u0026SNAPSHOT_NAME=Assignment-1\" https://api.example.com:5000/snapshot\n\"Success - Snapshot Created - assignment-1_2021-09-01 for Student: 31387714\"\nuser@host:~$\n```\n\n#\n\n### Create Snapshot for All Students\n\nCreates a Snapshot of the all students home directories with a common name, with the SNAPSHOT_NAME Post Value. The current date is added on to the end of the SNAPSHOT_NAME value. Should only be triggered once an hour.\n\n##### API URI: https://{HOST}:{PORT}/snapshot_all\n\n##### API Return HTTP Codes:\n- *200* Success with a POST Response\n- *406* Failure Missing Data, with a POST Response.\n- *404* Failure Not Found with a POST Response.\n\n\n#### Required Headers \u0026 Post Variables:\n\n|                |                 |                                       |\n|----------------|-----------------|---------------------------------------|\n| X-Api-Key      | Header Variable | The API Key is Provided by UBC IT     |\n| SNAPSHOT_NAME  | Post Variable   | The Name of the Snapshot              |\n| INCLUDE_HIDDEN | Post Variable   | Whether to include hidden directories |\n\n#### Curl Command Call Examples:\n\n*In the following example(s) we will use HEADER variable __X-Api-Key__ with a value of '12345', a __SNAPSHOT_NAME__ POST variable with a value of 'assignment-1-all', and a URL of __https://api.example.com:5000/snapshot_all__*\n\n1. curl -X POST -H \"X-Api-Key: 12345\" -F \"STUDENT_NAME=assignment-1-all\" https://api.example.com:5000/snapshot_all\n2. curl -X POST -H \"X-Api-Key: 12345\" -d \"STUDENT_NAME=assignment-1-all\" https://api.example.com:5000/snapshot_all\n3. curl -X POST -H \"X-Api-Key: 12345\" -data \"STUDENT_NAME=assignment-1-all\" https://api.example.com:5000/snapshot_all\n\n```\nuser@host:~$  curl -X POST -H \"X-Api-Key: 12345\" -d \"STUDENT_NAME=assignment-1-all\" https://api.example.com:5000/snapshot_all\n\"Success - Snapshot Created - assignment-1-all_2021-09-01 for All Students\"\nuser@host:~$\n```\n\n\n## Environment Variables\n\n| Environment Variable | Required | Default Value                            | Description                                                   |\n|----------------------|----------|------------------------------------------|---------------------------------------------------------------|\n| DEBUG                | TRUE     | Enables Debug output within the API code |\n| JUPYTER_API_PORT     | 5000     | The Port Number of the API               |\n| JUPYTER_API_HOST     | 0.0.0.0  | The IP the API is being served on        |\n| JUPYTER_API_KEY      | \u0026check;  | 12345                                    | The API Key                                                   |\n| JNOTE_HOME           | \u0026check;  | {No Default Value}                       | The location of Jupyter Notebooks' user Home directory        |\n| JNOTE_SNAP           | \u0026check;  | {No Default Value}                       | The location of Jupyter Notebooks final Snapshot directory    |\n| JNOTE_INTSNAP        | \u0026check;  | {No Default Value}                       | The location of Jupyter Notebooks internal Snapshot directory |\n| JNOTE_COURSE_CODE    | \u0026check;  | {No Default Value}                       | The Course Code                                               |\n\n\n\n## Repo Files\n\n## Jupyter Hub \u0026 Canvas LTI\n\n  ### Requirements:\n  1. The Jupyter user instances' home directory storage must be accessible to the API System via a mount point. Suggested Types include, NFS, AWS EFS via NFS, CephFS, CIFS, etc.\n  2. The Canvas LTI Application needs to be setup in Public Mode in order to share the Canvas Student ID's with the API system.\n\n  ### Canvas LTI Example\n\n  \u003cimg src=\"https://github.com/ubc/jupyter-canvas-api/blob/master/LTI.png?raw=true\" width=\"500\"\u003e\u003c/img\u003e\n\n## Docker Deployments\n\n## Virtual Machine Deployments\n\n*This deployment has been tested on Ubuntu 20.04, however it should work with previous versions of Ubuntu and Debian.*\n\n```\n# Prep System\nsudo apt update\nsudp apy upgrade\nsudo apt install python3 python3-pip curl rsync git\n\n# Get This Repo\ncd /tmp\ngit clone https://github.com/ubc/jupyter-canvas-api.git\ncd jupyter-canvas-api\nsudo mkdir /usr/share/jupyter-canvas-api/\n\n# Copy Files\nsudo cp usr/share/jupyter-canvas-api/api-server.py /usr/share/jupyter-canvas-api/api-server.py\nsudo cp usr/share/jupyter-canvas-api/requirements.txt /usr/share/jupyter-canvas-api/requirements.txt\nsudo cp usr/local/bin/hourly-rsync.sh /usr/local/bin/hourly-rsync.sh\nsudo cp etc/systemd/system/jupyter-canvas-api.service /etc/systemd/system/jupyter-canvas-api.service\nsudo cp etc/systemd/system/jupyter-rsync.service /etc/systemd/system/jupyter-rsync.service\nsudo cp etc/systemd/system/jupyter-rsync.timer /etc/systemd/system/jupyter-rsync.timer\nsudo cp etc/systemd/system/mnt-efs.mount /etc/systemd/system/mnt-efs.mount\nsudo chmod +x /usr/local/bin/hourly-rsync.sh\n\n# SystemD\nsystemctl daemon-reload\nsystemctl enable jupyter-rsync.timer\nsystemctl enable jupyter-canvas-api.service\n# Update the following mount to fit your needs, or add the Jupyter Lab home directory mount point to /etc/fstab\n#systemctl enable mnt-efs.mount\n\n# Setup Python\nsudo pip3 install -r /usr/share/jupyter-canvas-api/requirements.txt\n\n# Add Enviroment Variables (Update These To Fit Your Needs)\nsudo echo 'JUPYTER_API_PORT=\"5000\"' \u003e\u003e /etc/environment\nsudo echo 'JUPYTER_API_HOST=\"0.0.0.0\"' \u003e\u003e /etc/environment\nsudo echo 'JUPYTER_API_KEY=\"12345\"' \u003e\u003e /etc/environment\nsudo echo 'JNOTE_HOME=\"/mnt/efs/stat-100a-home/\"' \u003e\u003e /etc/environment\nsudo echo 'JNOTE_SNAP=\"/mnt/efs/stat-100a-snap/\"' \u003e\u003e /etc/environment\nsudo echo 'JNOTE_INTSNAP=\"/mnt/efs/stat-100a-internal/\"' \u003e\u003e /etc/environment\nsudo echo 'JNOTE_COURSE_CODE=\"STAT100a\"' \u003e\u003e /etc/environment\n\n# Reboot\nsudo reboot now\n```\n\n## Kubernetes Pod Deployments\n\n## Notes\n\n- The API needs to be run as Root, as such the Environment Variables need to be accessible by Root.\n- On the Virtual Machine Deployment, the hourly rsync script is controlled by a SystemD Timer, rather than a cronjob. It should be simple to move back if desired.\n- On the docker/kubernetes deployment the hourly rsync script is controlled via cron. A script is placed into /etc/cron.hourly, and the /etc/crontab for that directory is triggered on the 17th minute.\n- When running the API call /snapshot_all there is a 1-hour cool down. If run sooner, it can take a long time to complete.\n\n## Support\n\nAs this is a Proof of Concept project no support is going to be provided unless you are an Instructor or UBC Staff member participating in the trial.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fubc%2Fjupyter-canvas-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fubc%2Fjupyter-canvas-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fubc%2Fjupyter-canvas-api/lists"}