.course. app

Source:
Functions for interacting with external LTI apps within courses

Methods

(async) addByClientId(opts, configopt) → {Promise.<CanvasExternalTool>}

Source:
Author:
  • Gabe Abrams
Adds an LTi app by its clientId to a Canvas course
Parameters:
Name Type Attributes Description
opts object object containing all arguments
Properties
Name Type Attributes Default Description
clientId string the client id of the app that is associated with the Canvas instance containing the course of interest
courseId number <optional>
default course id Canvas course Id to install into
config APIConfig <optional>
custom configuration for this specific endpoint call (overwrites defaults that were included when api was initialized)
Returns:
Type
Promise.<CanvasExternalTool>

(async) addByXML(opts, configopt) → {Promise.<CanvasExternalTool>}

Source:
Author:
  • Gabe Abrams
Adds an LTi app by its XML to a Canvas course
Parameters:
Name Type Attributes Description
opts object object containing all arguments
Properties
Name Type Attributes Default Description
name string The app name (for settings app list)
key string Installation consumer key
secret string Installation consumer secret
xml string XML configuration file, standard LTI format
description string A human-readable description of the app
courseId number <optional>
default course id Canvas course Id to install into
config APIConfig <optional>
custom configuration for this specific endpoint call (overwrites defaults that were included when api was initialized)
Returns:
Type
Promise.<CanvasExternalTool>

(async) addRedirect(opts, configopt) → {Promise.<CanvasExternalTool>}

Source:
Author:
  • Gabe Abrams
Add a redirect app to the navigation menu
Parameters:
Name Type Attributes Description
opts object object containing all arguments
Properties
Name Type Attributes Default Description
name string the name of the app as it shows up in the nav menu
url string the url to direct the course to when they click the redirect app
hiddenFromStudents boolean <optional>
if true, hide the link from students
dontOpenInNewTab boolean <optional>
if true, redirect does not open in another tab
courseId number <optional>
default course id Canvas course Id to install into
config APIConfig <optional>
custom configuration for this specific endpoint call (overwrites defaults that were included when api was initialized)
Returns:
Type
Promise.<CanvasExternalTool>

(async) get(opts, configopt) → {Promise.<CanvasExternalTool>}

Source:
Author:
  • Gabe Abrams
Gets info on a single LTI tool
Parameters:
Name Type Attributes Description
opts object object containing all arguments
Properties
Name Type Attributes Default Description
appId number The LTI app Id to get
courseId number <optional>
default course id Canvas course Id
config APIConfig <optional>
custom configuration for this specific endpoint call (overwrites defaults that were included when api was initialized)
Returns:
Type
Promise.<CanvasExternalTool>

(async) getAssignmentLaunchURL(opts, configopt) → {Promise.<string>}

Source:
Author:
  • Gabe Abrams
Gets a sessionless navigation LTI launch URL
Parameters:
Name Type Attributes Description
opts object object containing all arguments
Properties
Name Type Attributes Default Description
appId number The LTI app Id to get a launch URL for
assignmentId number the Canvas assignment id to launch
courseId number <optional>
default course id Canvas course Id that holds the app from
config APIConfig <optional>
custom configuration for this specific endpoint call (overwrites defaults that were included when api was initialized)
Returns:
launch url
Type
Promise.<string>

(async) getMetadata(opts, configopt) → {Promise.<object>}

Source:
Author:
  • Gabe Abrams
Gets the metadata for an LTI app in a course. Note: this endpoint requires that the app have a custom parameter called 'metadata_id' with an identifier that we will use to refer to the metadata. If each installation of an app will have its own metadata, each installation should have a different metadata_id. If all installations share the same metadata, they should all have the same metadata_id. When getting metadata, we return the metadata for the first app we find that has this metadata_id. Also note that the variable is 'metadata_id' all lowercase because launch params are made lowercase.
Parameters:
Name Type Attributes Description
opts object object containing all arguments
Properties
Name Type Attributes Default Description
metadata_id number metadata identifier (see endpoint description)
courseId number <optional>
default course id Canvas course Id that holds the app
config APIConfig <optional>
custom configuration for this specific endpoint call (overwrites defaults that were included when api was initialized)
Returns:
the metadata for the first app that has the given metadata_id
Type
Promise.<object>

(async) getNavLaunchURL(opts, configopt) → {Promise.<string>}

Source:
Author:
  • Gabe Abrams
Gets a sessionless navigation LTI launch URL
Parameters:
Name Type Attributes Description
opts object object containing all arguments
Properties
Name Type Attributes Default Description
appId number The LTI app Id to get a launch URL for
courseId number <optional>
default course id Canvas course Id that holds the app
config APIConfig <optional>
custom configuration for this specific endpoint call (overwrites defaults that were included when api was initialized)
Returns:
launch URL
Type
Promise.<string>

(async) hideFromNav(opts) → {Promise.<CanvasTab>}

Source:
Author:
  • Gabe Abrams
Hides an app from the left-hand navigation menu if it was visible
Parameters:
Name Type Description
opts object object containing all arguments
Properties
Name Type Attributes Default Description
appId number The LTI app Id to hide
courseId number <optional>
default course id Canvas course Id for the course containing the app
Returns:
Type
Promise.<CanvasTab>

(async) list(optsopt, configopt) → {Promise.<Array.<CanvasExternalTool>>}

Source:
Author:
  • Gabe Abrams
Gets the list of apps installed into a course
Parameters:
Name Type Attributes Description
opts object <optional>
object containing all arguments
Properties
Name Type Attributes Default Description
courseId number <optional>
default course id Canvas course Id to query
excludeParents boolean <optional>
If true, excludes tools installed in all accounts above the current context
config APIConfig <optional>
custom configuration for this specific endpoint call (overwrites defaults that were included when api was initialized)
Returns:
Type
Promise.<Array.<CanvasExternalTool>>

(async) moveToTopOfNavMenu(opts, configopt) → {Promise.<CanvasTab>}

Source:
Author:
  • Gabe Abrams
Move an app near the top of the nav menu and make sure it's visible
Parameters:
Name Type Attributes Description
opts object object containing all arguments
Properties
Name Type Attributes Default Description
appId number The LTI app Id to make visible and move near the top of the nav menu
courseId number <optional>
default course id Canvas course Id that holds the app
config APIConfig <optional>
custom configuration for this specific endpoint call (overwrites defaults that were included when api was initialized)
Returns:
Type
Promise.<CanvasTab>

(async) remove(opts, configopt) → {Promise.<CanvasExternalTool>}

Source:
Author:
  • Gabe Abrams
Removes an LTI app from a Canvas course
Parameters:
Name Type Attributes Description
opts object object containing all arguments
Properties
Name Type Attributes Default Description
appId number The LTI app Id to remove
courseId number <optional>
default course id Canvas course Id to remove app from
config APIConfig <optional>
custom configuration for this specific endpoint call (overwrites defaults that were included when api was initialized)
Returns:
Type
Promise.<CanvasExternalTool>

(async) showInNav(opts) → {Promise.<CanvasTab>}

Source:
Author:
  • Gabe Abrams
Makes an app visible in the left-hand navigation menu if it was hidden
Parameters:
Name Type Description
opts object object containing all arguments
Properties
Name Type Attributes Default Description
appId number The LTI app Id to make visible
putAtTop boolean <optional>
if true, put the app at the top of the left-hand nav menu
courseId number <optional>
default course id Canvas course Id for the course containing the app
Returns:
Type
Promise.<CanvasTab>

(async) updateMetadata(opts, configopt) → {Promise.<Array.<CanvasExternalTool>>}

Source:
Author:
  • Gabe Abrams
Updates the metadata for an LTI app in a course. Note: this endpoint requires that the app have a custom parameter called 'metadata_id' with an identifier that we will use to refer to the metadata. If each installation of an app will have its own metadata, each installation should have a different metadata_id. If all installations share the same metadata, they should all have the same metadata_id. When getting metadata, we return the metadata for the first app we find that has this metadata_id. Also note that the variable is 'metadata_id' all lowercase because launch params are made lowercase.
Parameters:
Name Type Attributes Description
opts object object containing all arguments
Properties
Name Type Attributes Default Description
metadata_id number metadata identifier (see endpoint description)
metadata object <optional>
{} json metadata object
courseId number <optional>
default course id Canvas course Id that holds the app
config APIConfig <optional>
custom configuration for this specific endpoint call (overwrites defaults that were included when api was initialized)
Returns:
Type
Promise.<Array.<CanvasExternalTool>>