Documentation

ExternalTool extends AbstractBaseApi

Canvas LMS External Tools API

Provides functionality to manage external tools (LTI integrations) in Canvas LMS. This class handles creating, reading, updating, and deleting external tools in both account and course contexts. External tools are IMS LTI links that extend Canvas functionality with third-party applications.

Usage Examples:

// Account context (default)
$tools = ExternalTool::get();
$tool = ExternalTool::create([
    'name' => 'My LTI Tool',
    'consumer_key' => 'key123',
    'shared_secret' => 'secret456',
    'url' => 'https://tool.example.com/lti/launch',
    'privacy_level' => 'public'
]);

// Course context via Course instance
$course = Course::find(123);
$tools = $course->externalTools();

// Direct context access
$tools = ExternalTool::fetchByContext('courses', 123);
$tool = ExternalTool::createInContext('courses', 123, [
    'name' => 'Course LTI Tool',
    'consumer_key' => 'key456',
    'shared_secret' => 'secret789',
    'url' => 'https://tool.example.com/lti/launch',
    'privacy_level' => 'public'
]);

// Finding and updating tools
$tool = ExternalTool::find(456); // Searches in account context
$tool = ExternalTool::findByContext('courses', 123, 456); // Course-specific

$tool = ExternalTool::update(456, ['name' => 'Updated Tool Name']);

// Using DTOs
$dto = new CreateExternalToolDTO();
$dto->name = 'My Tool';
$dto->consumerKey = 'key123';
$dto->sharedSecret = 'secret456';
$dto->url = 'https://tool.example.com';
$dto->privacyLevel = 'public';
$tool = ExternalTool::create($dto);

// Generate sessionless launch URL
$launchData = ExternalTool::generateSessionlessLaunch(['id' => 456]);

Table of Contents

Properties

$accountNavigation  : array<string, mixed>|null
The configuration for account navigation links
$assignmentSelection  : array<string, mixed>|null
The configuration for assignment selection links
$consumerKey  : string|null
The consumer key used by the tool (shared secret is not returned)
$contextId  : int|null
The context ID for the external tool
$contextType  : string|null
The context type (account, course) for the external tool
$courseHomeSubNavigation  : array<string, mixed>|null
The configuration for course home navigation links
$courseNavigation  : array<string, mixed>|null
The configuration for course navigation links
$createdAt  : string|null
External tool creation timestamp
$customFields  : array<string, string>|null
Custom fields that will be sent to the tool consumer
$deploymentId  : string|null
The unique identifier for the deployment of the tool
$description  : string|null
External tool description
$domain  : string|null
The domain to match links against
$editorButton  : array<string, mixed>|null
The configuration for a WYSIWYG editor button
$homeworkSubmission  : array<string, mixed>|null
The configuration for homework submission selection
$iconUrl  : string|null
The url for the tool icon
$id  : int|null
External tool unique identifier
$isRceFavorite  : bool|null
Boolean determining whether this tool should be in a preferred location in the RCE
$isTopNavFavorite  : bool|null
Boolean determining whether this tool should have a dedicated button in Top Navigation
$linkSelection  : array<string, mixed>|null
The configuration for link selection
$migrationSelection  : array<string, mixed>|null
The configuration for migration selection
$name  : string|null
External tool name
$notSelectable  : bool|null
Whether the tool is not selectable from assignment and modules
$privacyLevel  : string|null
How much user information to send to the external tool Allowed values: anonymous, name_only, email_only, public
$resourceSelection  : array<string, mixed>|null
The configuration for a resource selector in modules
$selectionHeight  : int|null
The pixel height of the iFrame that the tool will be rendered in
$selectionWidth  : int|null
The pixel width of the iFrame that the tool will be rendered in
$sharedSecret  : string|null
The shared secret with the external tool (only used for creation/updates)
$toolConfiguration  : array<string, mixed>|null
The configuration for a tool configuration link
$unifiedToolId  : string|null
The unique identifier for the tool in LearnPlatform
$updatedAt  : string|null
External tool last update timestamp
$url  : string|null
The URL to match links against
$userNavigation  : array<string, mixed>|null
The configuration for user navigation links
$workflowState  : string|null
The workflow state of the external tool
$apiClient  : HttpClientInterface
$methodAliases  : array<string|int, mixed>
Define method aliases

Methods

__callStatic()  : mixed
Magic method to handle function aliases
__construct()  : mixed
Create a new ExternalTool instance
all()  : array<string|int, static>
Get all external tools.
create()  : self
Create a new external tool in the default account context
createInContext()  : self
Create a new external tool in a specific context
delete()  : self
Delete the external tool
fetchByContext()  : array<string|int, self>
List external tools for a specific context
fetchByContextPaginated()  : PaginatedResponse
Get paginated external tools for a specific context
find()  : self
Find a single external tool by ID in the default account context
findByContext()  : self
Find an external tool by ID in a specific context
generateSessionlessLaunch()  : array<string, mixed>
Generate a sessionless launch URL for an external tool in account context
generateSessionlessLaunchInContext()  : array<string, mixed>
Generate a sessionless launch URL for an external tool in a specific context
get()  : array<string|int, static>
Get first page of external tools.
getAccountNavigation()  : array<string, mixed>|null
Get account navigation configuration
getAssignmentSelection()  : array<string, mixed>|null
Get assignment selection configuration
getConsumerKey()  : string|null
Get consumer key
getContextId()  : int|null
Get context ID
getContextType()  : string|null
Get context type
getCourseHomeSubNavigation()  : array<string, mixed>|null
Get course home sub navigation configuration
getCourseNavigation()  : array<string, mixed>|null
Get course navigation configuration
getCreatedAt()  : string|null
Get created at timestamp
getCustomFields()  : array<string, string>|null
Get custom fields
getDeploymentId()  : string|null
Get deployment ID
getDescription()  : string|null
Get external tool description
getDomain()  : string|null
Get domain
getEditorButton()  : array<string, mixed>|null
Get editor button configuration
getHomeworkSubmission()  : array<string, mixed>|null
Get homework submission configuration
getIconUrl()  : string|null
Get icon URL
getId()  : int|null
Get external tool ID
getIsRceFavorite()  : bool|null
Get RCE favorite status
getIsTopNavFavorite()  : bool|null
Get top navigation favorite status
getLaunchUrl()  : string
Generate launch URL for this external tool
getLinkSelection()  : array<string, mixed>|null
Get link selection configuration
getMigrationSelection()  : array<string, mixed>|null
Get migration selection configuration
getName()  : string|null
Get external tool name
getNotSelectable()  : bool|null
Get not selectable status
getPrivacyLevel()  : string|null
Get privacy level
getResourceSelection()  : array<string, mixed>|null
Get resource selection configuration
getSelectionHeight()  : int|null
Get selection height
getSelectionWidth()  : int|null
Get selection width
getSharedSecret()  : string|null
Get shared secret
getToolConfiguration()  : array<string, mixed>|null
Get tool configuration
getUnifiedToolId()  : string|null
Get unified tool ID
getUpdatedAt()  : string|null
Get updated at timestamp
getUrl()  : string|null
Get URL
getUserNavigation()  : array<string, mixed>|null
Get user navigation configuration
getWorkflowState()  : string|null
Get workflow state
paginate()  : PaginationResult
Get paginated results with metadata
save()  : self
Save the current external tool (create or update)
setAccountNavigation()  : void
Set account navigation configuration
setApiClient()  : void
Set the API client
setAssignmentSelection()  : void
Set assignment selection configuration
setConsumerKey()  : void
Set consumer key
setContextId()  : void
Set context ID
setContextType()  : void
Set context type
setCourseHomeSubNavigation()  : void
Set course home sub navigation configuration
setCourseNavigation()  : void
Set course navigation configuration
setCreatedAt()  : void
Set created at timestamp
setCustomFields()  : void
Set custom fields
setDeploymentId()  : void
Set deployment ID
setDescription()  : void
Set external tool description
setDomain()  : void
Set domain
setEditorButton()  : void
Set editor button configuration
setHomeworkSubmission()  : void
Set homework submission configuration
setIconUrl()  : void
Set icon URL
setId()  : void
Set external tool ID
setIsRceFavorite()  : void
Set RCE favorite status
setIsTopNavFavorite()  : void
Set top navigation favorite status
setLinkSelection()  : void
Set link selection configuration
setMigrationSelection()  : void
Set migration selection configuration
setName()  : void
Set external tool name
setNotSelectable()  : void
Set not selectable status
setPrivacyLevel()  : void
Set privacy level
setResourceSelection()  : void
Set resource selection configuration
setSelectionHeight()  : void
Set selection height
setSelectionWidth()  : void
Set selection width
setSharedSecret()  : void
Set shared secret
setToolConfiguration()  : void
Set tool configuration
setUnifiedToolId()  : void
Set unified tool ID
setUpdatedAt()  : void
Set updated at timestamp
setUrl()  : void
Set URL
setUserNavigation()  : void
Set user navigation configuration
setWorkflowState()  : void
Set workflow state
toArray()  : array<string, mixed>
Convert external tool to array Note: Shared secret is excluded for security reasons as it should never be exposed
toDtoArray()  : array<string, mixed>
Convert external tool to DTO array format
update()  : self
Update an external tool in the default account context
updateInContext()  : self
Update an external tool in a specific context
validateConfiguration()  : bool
Validate external tool configuration
castValue()  : DateTime|mixed
Cast a value to the correct type
checkApiClient()  : void
Check if the API client is set, if not, instantiate a new one
convertPaginatedResponseToModels()  : array<string|int, static>
Helper method to convert paginated response data to model instances
createConfiguredHttpClient()  : HttpClient
Create an HttpClient with configured middleware
createPaginationResult()  : PaginationResult
Helper method to create PaginationResult from paginated response
getEndpoint()  : string
Get the API endpoint for this resource
getPaginatedResponse()  : PaginatedResponse
Helper method to get paginated response from API endpoint
getResourceIdentifier()  : string
Get the resource identifier for API endpoints
populate()  : void
Populate the object with new data
isValidUrl()  : bool
Validate URL for security (HTTPS only, no malicious schemes)

Properties

$accountNavigation

The configuration for account navigation links

public array<string, mixed>|null $accountNavigation = null

$assignmentSelection

The configuration for assignment selection links

public array<string, mixed>|null $assignmentSelection = null

$consumerKey

The consumer key used by the tool (shared secret is not returned)

public string|null $consumerKey = null

$contextId

The context ID for the external tool

public int|null $contextId = null

$contextType

The context type (account, course) for the external tool

public string|null $contextType = null

$courseHomeSubNavigation

The configuration for course home navigation links

public array<string, mixed>|null $courseHomeSubNavigation = null

$courseNavigation

The configuration for course navigation links

public array<string, mixed>|null $courseNavigation = null

$createdAt

External tool creation timestamp

public string|null $createdAt = null

$customFields

Custom fields that will be sent to the tool consumer

public array<string, string>|null $customFields = null

$deploymentId

The unique identifier for the deployment of the tool

public string|null $deploymentId = null

$description

External tool description

public string|null $description = null

$domain

The domain to match links against

public string|null $domain = null

$editorButton

The configuration for a WYSIWYG editor button

public array<string, mixed>|null $editorButton = null

$homeworkSubmission

The configuration for homework submission selection

public array<string, mixed>|null $homeworkSubmission = null

$iconUrl

The url for the tool icon

public string|null $iconUrl = null

$id

External tool unique identifier

public int|null $id = null

$isRceFavorite

Boolean determining whether this tool should be in a preferred location in the RCE

public bool|null $isRceFavorite = null

$isTopNavFavorite

Boolean determining whether this tool should have a dedicated button in Top Navigation

public bool|null $isTopNavFavorite = null

$linkSelection

The configuration for link selection

public array<string, mixed>|null $linkSelection = null

$migrationSelection

The configuration for migration selection

public array<string, mixed>|null $migrationSelection = null

$name

External tool name

public string|null $name = null

$notSelectable

Whether the tool is not selectable from assignment and modules

public bool|null $notSelectable = null

$privacyLevel

How much user information to send to the external tool Allowed values: anonymous, name_only, email_only, public

public string|null $privacyLevel = null

$resourceSelection

The configuration for a resource selector in modules

public array<string, mixed>|null $resourceSelection = null

$selectionHeight

The pixel height of the iFrame that the tool will be rendered in

public int|null $selectionHeight = null

$selectionWidth

The pixel width of the iFrame that the tool will be rendered in

public int|null $selectionWidth = null

$sharedSecret

The shared secret with the external tool (only used for creation/updates)

public string|null $sharedSecret = null

$toolConfiguration

The configuration for a tool configuration link

public array<string, mixed>|null $toolConfiguration = null

$unifiedToolId

The unique identifier for the tool in LearnPlatform

public string|null $unifiedToolId = null

$updatedAt

External tool last update timestamp

public string|null $updatedAt = null

$url

The URL to match links against

public string|null $url = null

$userNavigation

The configuration for user navigation links

public array<string, mixed>|null $userNavigation = null

$workflowState

The workflow state of the external tool

public string|null $workflowState = null

$methodAliases

Define method aliases

protected static array<string|int, mixed> $methodAliases = ['get' => ['fetch', 'list', 'fetchAll'], 'all' => ['fetchAllPages', 'getAll'], 'paginate' => ['getPaginated', 'withPagination', 'fetchPage'], 'find' => ['one', 'getOne']]

Methods

__callStatic()

Magic method to handle function aliases

public static __callStatic(string $name, array<string|int, mixed> $arguments) : mixed
Parameters
$name : string
$arguments : array<string|int, mixed>
Tags
throws
InvalidArgumentException

__construct()

Create a new ExternalTool instance

public __construct([array<string, mixed> $data = [] ]) : mixed
Parameters
$data : array<string, mixed> = []

External tool data from Canvas API

all()

Get all external tools.

public static all([array<string, mixed> $params = [] ]) : array<string|int, static>

Overrides base to set context information.

Parameters
$params : array<string, mixed> = []

Query parameters

Return values
array<string|int, static>

createInContext()

Create a new external tool in a specific context

public static createInContext(string $contextType, int $contextId, array<string, mixed>|CreateExternalToolDTO $data) : self
Parameters
$contextType : string

Context type (accounts, courses)

$contextId : int

Context ID

$data : array<string, mixed>|CreateExternalToolDTO

External tool data

Tags
throws
CanvasApiException
Return values
self

fetchByContext()

List external tools for a specific context

public static fetchByContext(string $contextType, int $contextId[, array<string, mixed> $params = [] ]) : array<string|int, self>
Parameters
$contextType : string

'accounts' or 'courses'

$contextId : int

Account or Course ID

$params : array<string, mixed> = []

Query parameters

Tags
throws
CanvasApiException
Return values
array<string|int, self>

fetchByContextPaginated()

Get paginated external tools for a specific context

public static fetchByContextPaginated(string $contextType, int $contextId[, array<string, mixed> $params = [] ]) : PaginatedResponse
Parameters
$contextType : string

'accounts' or 'courses'

$contextId : int

Account or Course ID

$params : array<string, mixed> = []

Query parameters

Tags
throws
CanvasApiException
Return values
PaginatedResponse

find()

Find a single external tool by ID in the default account context

public static find(int $id[, array<string|int, mixed> $params = [] ]) : self
Parameters
$id : int

External tool ID

$params : array<string|int, mixed> = []

Optional query parameters

Tags
throws
CanvasApiException
Return values
self

findByContext()

Find an external tool by ID in a specific context

public static findByContext(string $contextType, int $contextId, int $id) : self
Parameters
$contextType : string

Context type (accounts, courses)

$contextId : int

Context ID

$id : int

External tool ID

Tags
throws
CanvasApiException
Return values
self

generateSessionlessLaunch()

Generate a sessionless launch URL for an external tool in account context

public static generateSessionlessLaunch(array<string, mixed> $params) : array<string, mixed>
Parameters
$params : array<string, mixed>

Launch parameters

Tags
throws
CanvasApiException
Return values
array<string, mixed>

Launch data with id, name, and url

generateSessionlessLaunchInContext()

Generate a sessionless launch URL for an external tool in a specific context

public static generateSessionlessLaunchInContext(string $contextType, int $contextId, array<string, mixed> $params) : array<string, mixed>
Parameters
$contextType : string

Context type (accounts, courses)

$contextId : int

Context ID

$params : array<string, mixed>

Launch parameters

Tags
throws
CanvasApiException
Return values
array<string, mixed>

Launch data with id, name, and url

get()

Get first page of external tools.

public static get([array<string, mixed> $params = [] ]) : array<string|int, static>

Overrides base to set context information.

Parameters
$params : array<string, mixed> = []

Query parameters

Return values
array<string|int, static>

getAccountNavigation()

Get account navigation configuration

public getAccountNavigation() : array<string, mixed>|null
Return values
array<string, mixed>|null

getAssignmentSelection()

Get assignment selection configuration

public getAssignmentSelection() : array<string, mixed>|null
Return values
array<string, mixed>|null

getConsumerKey()

Get consumer key

public getConsumerKey() : string|null
Return values
string|null

getContextId()

Get context ID

public getContextId() : int|null
Return values
int|null

getContextType()

Get context type

public getContextType() : string|null
Return values
string|null

getCourseHomeSubNavigation()

Get course home sub navigation configuration

public getCourseHomeSubNavigation() : array<string, mixed>|null
Return values
array<string, mixed>|null

getCourseNavigation()

Get course navigation configuration

public getCourseNavigation() : array<string, mixed>|null
Return values
array<string, mixed>|null

getCreatedAt()

Get created at timestamp

public getCreatedAt() : string|null
Return values
string|null

getCustomFields()

Get custom fields

public getCustomFields() : array<string, string>|null
Return values
array<string, string>|null

getDeploymentId()

Get deployment ID

public getDeploymentId() : string|null
Return values
string|null

getDescription()

Get external tool description

public getDescription() : string|null
Return values
string|null

getDomain()

Get domain

public getDomain() : string|null
Return values
string|null

getEditorButton()

Get editor button configuration

public getEditorButton() : array<string, mixed>|null
Return values
array<string, mixed>|null

getHomeworkSubmission()

Get homework submission configuration

public getHomeworkSubmission() : array<string, mixed>|null
Return values
array<string, mixed>|null

getIconUrl()

Get icon URL

public getIconUrl() : string|null
Return values
string|null

getId()

Get external tool ID

public getId() : int|null
Return values
int|null

getIsRceFavorite()

Get RCE favorite status

public getIsRceFavorite() : bool|null
Return values
bool|null

getIsTopNavFavorite()

Get top navigation favorite status

public getIsTopNavFavorite() : bool|null
Return values
bool|null

getLaunchUrl()

Generate launch URL for this external tool

public getLaunchUrl([array<string, mixed> $params = [] ]) : string
Parameters
$params : array<string, mixed> = []

Optional launch parameters

Tags
throws
CanvasApiException
Return values
string

The launch URL

getLinkSelection()

Get link selection configuration

public getLinkSelection() : array<string, mixed>|null
Return values
array<string, mixed>|null

getMigrationSelection()

Get migration selection configuration

public getMigrationSelection() : array<string, mixed>|null
Return values
array<string, mixed>|null

getName()

Get external tool name

public getName() : string|null
Return values
string|null

getNotSelectable()

Get not selectable status

public getNotSelectable() : bool|null
Return values
bool|null

getPrivacyLevel()

Get privacy level

public getPrivacyLevel() : string|null
Return values
string|null

getResourceSelection()

Get resource selection configuration

public getResourceSelection() : array<string, mixed>|null
Return values
array<string, mixed>|null

getSelectionHeight()

Get selection height

public getSelectionHeight() : int|null
Return values
int|null

getSelectionWidth()

Get selection width

public getSelectionWidth() : int|null
Return values
int|null

getSharedSecret()

Get shared secret

public getSharedSecret() : string|null
Return values
string|null

getToolConfiguration()

Get tool configuration

public getToolConfiguration() : array<string, mixed>|null
Return values
array<string, mixed>|null

getUnifiedToolId()

Get unified tool ID

public getUnifiedToolId() : string|null
Return values
string|null

getUpdatedAt()

Get updated at timestamp

public getUpdatedAt() : string|null
Return values
string|null

getUrl()

Get URL

public getUrl() : string|null
Return values
string|null

getUserNavigation()

Get user navigation configuration

public getUserNavigation() : array<string, mixed>|null
Return values
array<string, mixed>|null

getWorkflowState()

Get workflow state

public getWorkflowState() : string|null
Return values
string|null

setAccountNavigation()

Set account navigation configuration

public setAccountNavigation(array<string, mixed>|null $accountNavigation) : void
Parameters
$accountNavigation : array<string, mixed>|null

setAssignmentSelection()

Set assignment selection configuration

public setAssignmentSelection(array<string, mixed>|null $assignmentSelection) : void
Parameters
$assignmentSelection : array<string, mixed>|null

setConsumerKey()

Set consumer key

public setConsumerKey(string|null $consumerKey) : void
Parameters
$consumerKey : string|null

setContextId()

Set context ID

public setContextId(int|null $contextId) : void
Parameters
$contextId : int|null

setContextType()

Set context type

public setContextType(string|null $contextType) : void
Parameters
$contextType : string|null

setCourseHomeSubNavigation()

Set course home sub navigation configuration

public setCourseHomeSubNavigation(array<string, mixed>|null $courseHomeSubNavigation) : void
Parameters
$courseHomeSubNavigation : array<string, mixed>|null

setCourseNavigation()

Set course navigation configuration

public setCourseNavigation(array<string, mixed>|null $courseNavigation) : void
Parameters
$courseNavigation : array<string, mixed>|null

setCreatedAt()

Set created at timestamp

public setCreatedAt(string|null $createdAt) : void
Parameters
$createdAt : string|null

setCustomFields()

Set custom fields

public setCustomFields(array<string, string>|null $customFields) : void
Parameters
$customFields : array<string, string>|null

setDeploymentId()

Set deployment ID

public setDeploymentId(string|null $deploymentId) : void
Parameters
$deploymentId : string|null

setDescription()

Set external tool description

public setDescription(string|null $description) : void
Parameters
$description : string|null

setDomain()

Set domain

public setDomain(string|null $domain) : void
Parameters
$domain : string|null

setEditorButton()

Set editor button configuration

public setEditorButton(array<string, mixed>|null $editorButton) : void
Parameters
$editorButton : array<string, mixed>|null

setHomeworkSubmission()

Set homework submission configuration

public setHomeworkSubmission(array<string, mixed>|null $homeworkSubmission) : void
Parameters
$homeworkSubmission : array<string, mixed>|null

setIconUrl()

Set icon URL

public setIconUrl(string|null $iconUrl) : void
Parameters
$iconUrl : string|null

setId()

Set external tool ID

public setId(int|null $id) : void
Parameters
$id : int|null

setIsRceFavorite()

Set RCE favorite status

public setIsRceFavorite(bool|null $isRceFavorite) : void
Parameters
$isRceFavorite : bool|null

setIsTopNavFavorite()

Set top navigation favorite status

public setIsTopNavFavorite(bool|null $isTopNavFavorite) : void
Parameters
$isTopNavFavorite : bool|null

setLinkSelection()

Set link selection configuration

public setLinkSelection(array<string, mixed>|null $linkSelection) : void
Parameters
$linkSelection : array<string, mixed>|null

setMigrationSelection()

Set migration selection configuration

public setMigrationSelection(array<string, mixed>|null $migrationSelection) : void
Parameters
$migrationSelection : array<string, mixed>|null

setName()

Set external tool name

public setName(string|null $name) : void
Parameters
$name : string|null

setNotSelectable()

Set not selectable status

public setNotSelectable(bool|null $notSelectable) : void
Parameters
$notSelectable : bool|null

setPrivacyLevel()

Set privacy level

public setPrivacyLevel(string|null $privacyLevel) : void
Parameters
$privacyLevel : string|null

setResourceSelection()

Set resource selection configuration

public setResourceSelection(array<string, mixed>|null $resourceSelection) : void
Parameters
$resourceSelection : array<string, mixed>|null

setSelectionHeight()

Set selection height

public setSelectionHeight(int|null $selectionHeight) : void
Parameters
$selectionHeight : int|null

setSelectionWidth()

Set selection width

public setSelectionWidth(int|null $selectionWidth) : void
Parameters
$selectionWidth : int|null

setSharedSecret()

Set shared secret

public setSharedSecret(string|null $sharedSecret) : void
Parameters
$sharedSecret : string|null

setToolConfiguration()

Set tool configuration

public setToolConfiguration(array<string, mixed>|null $toolConfiguration) : void
Parameters
$toolConfiguration : array<string, mixed>|null

setUnifiedToolId()

Set unified tool ID

public setUnifiedToolId(string|null $unifiedToolId) : void
Parameters
$unifiedToolId : string|null

setUpdatedAt()

Set updated at timestamp

public setUpdatedAt(string|null $updatedAt) : void
Parameters
$updatedAt : string|null

setUrl()

Set URL

public setUrl(string|null $url) : void
Parameters
$url : string|null

setUserNavigation()

Set user navigation configuration

public setUserNavigation(array<string, mixed>|null $userNavigation) : void
Parameters
$userNavigation : array<string, mixed>|null

setWorkflowState()

Set workflow state

public setWorkflowState(string|null $workflowState) : void
Parameters
$workflowState : string|null

toArray()

Convert external tool to array Note: Shared secret is excluded for security reasons as it should never be exposed

public toArray() : array<string, mixed>
Return values
array<string, mixed>

toDtoArray()

Convert external tool to DTO array format

public toDtoArray() : array<string, mixed>
Return values
array<string, mixed>

updateInContext()

Update an external tool in a specific context

public static updateInContext(string $contextType, int $contextId, int $id, array<string, mixed>|UpdateExternalToolDTO $data) : self
Parameters
$contextType : string

Context type (accounts, courses)

$contextId : int

Context ID

$id : int

External tool ID

$data : array<string, mixed>|UpdateExternalToolDTO

External tool data

Tags
throws
CanvasApiException
Return values
self

validateConfiguration()

Validate external tool configuration

public validateConfiguration() : bool
Return values
bool

True if configuration is valid

castValue()

Cast a value to the correct type

protected castValue(string $key, mixed $value) : DateTime|mixed
Parameters
$key : string
$value : mixed
Tags
throws
Exception
Return values
DateTime|mixed

checkApiClient()

Check if the API client is set, if not, instantiate a new one

protected static checkApiClient() : void

convertPaginatedResponseToModels()

Helper method to convert paginated response data to model instances

protected static convertPaginatedResponseToModels(PaginatedResponse $paginatedResponse) : array<string|int, static>
Parameters
$paginatedResponse : PaginatedResponse
Return values
array<string|int, static>

getEndpoint()

Get the API endpoint for this resource

protected static getEndpoint() : string
Return values
string

getPaginatedResponse()

Helper method to get paginated response from API endpoint

protected static getPaginatedResponse(string $endpoint[, array<string|int, mixed> $params = [] ]) : PaginatedResponse
Parameters
$endpoint : string

The API endpoint path

$params : array<string|int, mixed> = []

Query parameters for the request

Return values
PaginatedResponse

getResourceIdentifier()

Get the resource identifier for API endpoints

protected static getResourceIdentifier() : string
Return values
string

populate()

Populate the object with new data

protected populate(array<string|int, mixed> $data) : void
Parameters
$data : array<string|int, mixed>
Tags
throws
Exception

isValidUrl()

Validate URL for security (HTTPS only, no malicious schemes)

private isValidUrl(string $url) : bool
Parameters
$url : string

URL to validate

Return values
bool

True if URL is valid and secure


        
On this page

Search results