Files API
This page documents the Files API of Canvas, see https://canvas.instructure.com/doc/api/files for details.
Canvas.copy_file
Canvas.copy_folder
Canvas.create_folder
Canvas.delete_file
Canvas.delete_folder
Canvas.download_file
Canvas.file
Canvas.files
Canvas.folder
Canvas.folders
Canvas.licenses
Canvas.media_folder
Canvas.preview_url
Canvas.quota
Canvas.remove_usage_rights
Canvas.resolve_path
Canvas.update_file
Canvas.update_folder
Canvas.update_usage_rights
Canvas.upload_file
Canvas.files
— FunctionCanvas.files(co::Union{Course,Group,User,Folder}; kwargs...) -> Vector{File}, page_data
Return a paginated list of files for the course/groupt/user/folder. Return a vector of File
s 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...) -> File
Get 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...) -> File
Get 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...) -> File
Upload 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...) -> File
Update 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...) -> File
Delete 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...) -> File
Copy 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_data
Return a paginated list of folders in the specified folder. Return a vector of Folder
s 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_data
Return a paginated, flattened, list of all folders in the course/group/user. Return a vector of Folder
s 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...) -> Folder
Return 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...) -> Folder
Return 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...) -> Folder
Create 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...) -> Folder
Update 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...) -> Dict
Delete the folder. Return a dictionary.
Canvas API documentation: Delete folder (DELETE /api/v1/folders/:id
)
Canvas.copy_folder
— FunctionCanvas.copy_folder(f::Folder; kwargs...) -> Folder
Copy 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...) -> Dict
Return 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...) -> Dict
Determine 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 Folder
s.
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...) -> Folder
Return 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...) -> UsageRights
Set 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...) -> Dict
Remove 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_data
Return a paginated list of licenses that can be applied to files. Return a vector of License
s 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.