Files API
This page documents the Files API of Canvas, see https://canvas.instructure.com/doc/api/files for details.
Canvas.copy_fileCanvas.copy_folderCanvas.create_folderCanvas.delete_fileCanvas.delete_folderCanvas.download_fileCanvas.fileCanvas.filesCanvas.folderCanvas.foldersCanvas.licensesCanvas.media_folderCanvas.preview_urlCanvas.quotaCanvas.remove_usage_rightsCanvas.resolve_pathCanvas.update_fileCanvas.update_folderCanvas.update_usage_rightsCanvas.upload_file
Canvas.files — FunctionCanvas.files(co::Union{Course,Group,User,Folder}; kwargs...) -> Vector{File}, page_dataReturn a paginated list of files for the course/groupt/user/folder. Return a vector of Files and a dictionary of page data.
Canvas API documentation: List files (GET /api/v1/courses/:course_id/files, GET /api/v1/users/:user_id/files, GET /api/v1/groups/:group_id/files, GET /api/v1/folders/:id/files)
Canvas.file — FunctionCanvas.file(f::File; kwargs...) -> FileGet the details of a single file. Return a File.
Canvas API documentation: Get file (GET /api/v1/files/:id)
Canvas.file(co::Union{Course,Group,User}, f::File; kwargs...) -> FileGet the details of a single file. Return a File.
Canvas API documentation: Get file (GET /api/v1/courses/:course_id/files/:id, GET /api/v1/groups/:group_id/files/:id, GET /api/v1/users/:user_id/files/:id)
Canvas.upload_file — MethodCanvas.upload_file(f::Folder, file::String; kwargs...) -> FileUpload a file to a folder. Return a File.
Canvas API documentation: Upload a file (POST /api/v1/folders/:folder_id/files)
Canvas.update_file — FunctionCanvas.update_file(f::File; kwargs...) -> FileUpdate settings for the specified file. Return a File.
Canvas API documentation: Update file (PUT /api/v1/files/:id)
Canvas.delete_file — FunctionCanvas.delete_file(f::File; kwargs...) -> FileDelete the specified file and return the details. Return a File.
Canvas API documentation: Delete file (DELETE /api/v1/files/:id)
Canvas.copy_file — FunctionCanvas.copy_file(f::Folder; kwargs...) -> FileCopy a file into the specified folder. Return a File.
Canvas API documentation: Copy a file (POST /api/v1/folders/:dest_folder_id/copy_file)
Canvas.folders — FunctionCanvas.folders(f::Folder; kwargs...) -> Vector{Folder}, page_dataReturn a paginated list of folders in the specified folder. Return a vector of Folders and a dictionary with page data.
Canvas API documentation: List folders (GET /api/v1/folders/:id/folders)
Canvas.folders(co::Union{Course,Group,User}; kwargs...) -> Vector{Folder}, page_dataReturn a paginated, flattened, list of all folders in the course/group/user. Return a vector of Folders and a dictionary with page data.
Canvas API documentation: List all folders (GET /api/v1/courses/:course_id/folders, GET /api/v1/groups/:group_id/folders, GET /api/v1/users/:user_id/folders)
Canvas.folder — FunctionCanvas.folder(f::Folder; kwargs...) -> FolderReturn the details of a folder specified by id. Return a Folder.
Canvas API documentation: Get folder (GET /api/v1/folders/:id)
Canvas.folder(co::Union{Course,Group,User}, f::Folder; kwargs...) -> FolderReturn the details of a folder specified by id. Return a Folder.
Canvas API documentation: Get folder (GET /api/v1/courses/:course_id/folders/:id, GET /api/v1/groups/:group_id/folders/:id, GET /api/v1/users/:user_id/folders/:id)
Canvas.create_folder — FunctionCanvas.create_folder(co::Union{Course,Group,User,Folder}; kwargs...) -> FolderCreate a new folder in the course/group/user/folder. Return a Folder.
Canvas API documentation: Create folder (POST /api/v1/courses/:course_id/folders, POST /api/v1/groups/:group_id/folders, POST /api/v1/users/:user_id/folders, POST /api/v1/folders/:folder_id/folders)
Canvas.update_folder — FunctionCanvas.update_folder(f::Folder; kwargs...) -> FolderUpdate settings for the folder. Return a Folder.
Canvas API documentation: Update folder (PUT /api/v1/folders/:id)
Canvas.delete_folder — FunctionCanvas.delete_folder(f::Folder; kwargs...) -> DictDelete the folder. Return a dictionary.
Canvas API documentation: Delete folder (DELETE /api/v1/folders/:id)
Canvas.copy_folder — FunctionCanvas.copy_folder(f::Folder; kwargs...) -> FolderCopy a folder and its contents into the specified folder. Return a Folder.
Canvas API documentation: Copy a folder (POST /api/v1/folders/:dest_folder_id/copy_folder)
Canvas.quota — FunctionCanvas.quota(co::Union{Course,Group,User}; kwargs...) -> DictReturn the total and used storage quota for the course/group/user. Return a dictionary.
Canvas API documentation: Get quota information (GET /api/v1/courses/:course_id/files/quota, GET /api/v1/groups/:group_id/files/quota, GET /api/v1/users/:user_id/files/quota)
Canvas.preview_url — FunctionCanvas.preview_url(f::File; kwargs...) -> DictDetermine the URL that should be used for inline preview of the file. Return a dictionary.
Canvas API documentation: Get public inline preview url (GET /api/v1/files/:id/public_url)
Canvas.resolve_path — FunctionCanvas.resolve_path(co::Union{Course,Group,User}, path=""; kwargs...) -> Vector{Folder}Return the list of folders from the root of the course/group/user to the path path. Return a vector of Folders.
Canvas API documentation: Resolve path (GET /api/v1/courses/:course_id/folders/by_path, GET /api/v1/groups/:group_id/folders/by_path, GET /api/v1/users/:user_id/folders/by_path)
Canvas.media_folder — FunctionCanvas.media_folder(co::Union{Course,Group}; kwargs...) -> FolderReturn the details for a designated upload folder that the user has rights to upload to. Return a Folder.
Canvas API documentation: Get uploaded media folder for user (GET /api/v1/courses/:course_id/folders/media, GET /api/v1/groups/:group_id/folders/media)
Canvas.update_usage_rights — FunctionCanvas.update_usage_rights(co::Union{Course,Group,User}; kwargs...) -> UsageRightsSet copyright and license information for one or more files. Return a UsageRights.
Canvas API documentation: Set usage rights (PUT /api/v1/courses/:course_id/usage_rights, PUT /api/v1/groups/:group_id/usage_rights, PUT /api/v1/users/:user_id/usage_rights)
Canvas.remove_usage_rights — FunctionCanvas.remove_usage_rights(co::Union{Course,Group,User}; kwargs...) -> DictRemove copyright and license information associated with one or more files.
Canvas API documentation: Remove usage rights (DELETE /api/v1/courses/:course_id/usage_rights, DELETE /api/v1/groups/:group_id/usage_rights, DELETE /api/v1/users/:user_id/usage_rights)
Canvas.licenses — FunctionCanvas.licenses(co::Union{Course,Group,User}; kwargs...) -> Vector{License}, page_dataReturn a paginated list of licenses that can be applied to files. Return a vector of Licenses and a dictionary with page data.
Canvas API documentation: List licenses (GET /api/v1/courses/:course_id/content_licenses, GET /api/v1/groups/:group_id/content_licenses, GET /api/v1/users/:user_id/content_licenses)
Canvas.download_file — FunctionCanvas.download_file(f::File, local_path=mktempdir(); update_period=Inf, kwargs...)Download the File. If local_path is a directory the file will be placed in this directory with the upstream filename. If local_path is a file path the file will be downloaded to that path directly, ignoring the upstream filename.