ltiaas
v1.0.0
Published
The official LTIAAS client library.
Readme
LTIaaS Launch™ Node.js SDK
The LTIAAS Launch™ Node.js SDK is a comprehensive client library that provides easy integration with the LTIAAS platform for managing LTI (Learning Tools Interoperability) connections between learning platforms and tools.
The SDK handles all the complex LTI protocol requirements while providing a clean, intuitive interface for developers to build LTI tool integrations. It supports both LTI 1.3 and legacy versions, making it versatile for different integration needs.
More information about the LTIAAS platform can be found at https://ltiaas.com.
Installation
npm install ltiaasTable of Contents
- Installation
- Authentication
- LTIK Token Authentication
- Service Key Authentication
- API Key Authentication
- Authentication Examples
- Error Handling
- Core Methods
- ID Token
- Deep Linking
- Memberships
- Line Items & Scores
- Intermediate Target Dynamic Registration
- Platform (LMS) Registration Management
Authentication
The SDK supports three authentication methods:
- LTIK Token Authentication
- Service Key Authentication
- API Key Authentication
Authentication Examples
// LTIK Authentication
const client = new LaunchClient({
apiKey: "your-api-key",
ltik: "your-ltik-token"
});// Service Key Authentication
const client = new LaunchClient({
apiKey: "your-api-key",
serviceKey: "your-service-key"
});// API Key Authentication
const client = new LaunchClient({
apiKey: "your-api-key"
});Error Handling
The SDK includes built-in validation and error handling. For example, when using incorrect session types:
// This will throw InvalidSessionError if using wrong authentication type
try {
await client.getIdToken(); // Requires LTIK authentication
} catch (error) {
if (error instanceof InvalidSessionError) {
console.error(`Current session: ${error.currentSession}`);
console.error(`Allowed sessions: ${error.allowedSessionTypes.join(', ')}`);
}
}Core Methods
All of the LTIAAS API methods are available through the SDK. For more information about the LTIAAS API, refer to the [LTIAAS Launch™ API Documentation](https://ltiaas.com/api/ltiaas.
getIdToken
Retrieves the decoded LTI ID token for the current launch context. This method requires LTIK authentication.
Parameters
This method takes no parameters.
Return Type
Returns a Promise that resolves to an IdToken object containing:
|Property|Type|Description| |---|---|---| |ltiVersion|string|The LTI version being used| |user|object|User information including:| |user.id|string|Unique identifier for the user| |user.roles|string[]|Array of LTI roles for the user| |user.name|string?|User's full name| |user.email|string?|User's email address| |user.givenName|string?|User's first name| |user.familyName|string?|User's last name| |user.roleScopeMentor|string[]?|Array of mentor role scopes| |platform|object|Platform information including:| |platform.id|string?|Platform identifier| |platform.url|string?|Platform URL| |platform.clientId|string?|Client ID for the platform| |platform.name|string?|Platform name| |platform.version|string?|Platform version| |launch|object|Launch context information including:| |launch.type|enum|Type of LTI launch| |launch.target|string?|Launch target| |launch.context|object?|Course context information| |launch.resourceLink|object?|Resource link information| |launch.custom|object?|Custom parameters| |services|object|Available LTI services including:| |services.outcomes|object|Outcomes service availability| |services.deepLinking|object|Deep linking service availability|
Example Usage
// Get the ID token
const idToken = await client.getIdToken();
// Access user information
console.log(idToken.user.id);
console.log(idToken.user.roles);
// Access platform information
console.log(idToken.platform.name);
// Check service availability
console.log(idToken.services.outcomes.available);getRawIdToken
Retrieves the raw, unprocessed ID token from the current LTI session. This method requires LTIK authentication and returns the original token format based on the LTI version (1.3 or 1.2).
Parameters
This method doesn't accept any parameters.
Return Type
Returns a Promise that resolves to either RawIdToken (LTI 1.3) or RawOauthPayload (LTI 1.2)
LTI 1.3 Token Properties
ltiVersion: "1.3.0"iss: Issuer identifiersub: Subject identifieraud: Audienceexp: Expiration timestampiat: Issued at timestampnonce: Unique nonce valueazp: Authorized party (optional)name: User's full name (optional)email: User's email (optional)given_name: User's first name (optional)family_name: User's last name (optional)- Various LTI-specific claims prefixed with "https://purl.imsglobal.org/spec/lti/claim/"
LTI 1.2 Token Properties
ltiVersion: "1.2.0"lti_message_type: Launch message typeresource_link_id: Resource link identifieruser_id: User identifier (optional)roles: User roles (optional)- Various LTI 1.2 specific fields including context, user, and platform information
Example Usage
// Get raw ID token
const rawToken = await client.getRawIdToken();
// Check LTI version and handle accordingly
if (rawToken.ltiVersion === "1.3.0") {
// Handle LTI 1.3 token
console.log(rawToken.iss);
console.log(rawToken["https://purl.imsglobal.org/spec/lti/claim/message_type"]);
} else {
// Handle LTI 1.2 token
console.log(rawToken.resource_link_id);
console.log(rawToken.lti_message_type);
}buildDeepLinkingForm
Creates an HTML form for deep linking content items back to the platform. This method requires LTIK authentication.
Parameters
|Parameter|Type|Required|Description| |---|---|---|---| |contentItems|ContentItem[]|Yes|Array of content items to be sent back to the platform| |options|DeepLinkingOptions|No|Additional configuration options for the deep linking form|
Content Item Properties
A ContentItem can include:
type: Type of content (e.g., "ltiResourceLink")title: Title of the contenttext: Description of the contenturl: Target URL for the contentcustom: Custom parameters objectiframe: Iframe display settingswindow: Window display settingslineItem: Associated grade line item
Deep Linking Options
The DeepLinkingOptions object can include:
accept_types: Array of accepted content typesaccept_presentation_document_targets: Array of accepted presentation targetsaccept_media_types: Array of accepted media typesaccept_multiple: Boolean to allow multiple itemsauto_create: Boolean to automatically create itemstitle: Form titletext: Form description
Return Type
Returns a Promise that resolves to a string containing the complete HTML form markup.
Example Usage
// Create content items
const contentItems = [
{
type: "ltiResourceLink",
title: "My Resource",
url: "https://your.ltiaas.com/lti/launch?resource=2",
custom: {
difficulty: "intermediate"
}
}
];
// Build form with options
const form = await client.buildDeepLinkingForm(contentItems, {
accept_multiple: false,
auto_create: true
});
// The returned form can be inserted into your HTML
document.getElementById('form-container').innerHTML = form;buildDeepLinkingFormComponents
Generates form components for deep linking content items that can be used to create custom forms. This method requires LTIK authentication.
Parameters
|Parameter|Type|Required|Description| |---|---|---|---| |contentItems|ContentItem[]|Yes|Array of content items to be included in the deep linking form| |options|DeepLinkingOptions|No|Configuration options for the deep linking form|
Content Item Properties
Each content item in the array can include:
type: Content type (e.g., "ltiResourceLink")title: Title of the contenttext: Description texturl: Content URLcustom: Custom parameters objectiframe: Iframe display settingswindow: Window display settings
Deep Linking Options
The DeepLinkingOptions object can include:
accept_types: Array of accepted content typesaccept_presentation_document_targets: Array of accepted presentation targetsaccept_media_types: Array of accepted media typesaccept_multiple: Boolean to allow multiple itemsauto_create: Boolean to automatically create itemstitle: Form titletext: Form description
Return Type
Returns a Promise that resolves to a DeepLinkingFormComponents object containing:
jwt: JWT token for the formformData: Additional form data parametersendpoint: Form submission endpoint URL
Example Usage
// Create content items
const contentItems = [
{
type: "ltiResourceLink",
title: "Sample Resource",
url: "https://your.ltiaas.com/lti/launch?resource=2",
custom: {
difficulty: "intermediate"
}
}
];
// Build form components with options
const formComponents = await client.buildDeepLinkingFormComponents(contentItems, {
accept_types: ["ltiResourceLink"],
accept_multiple: false,
auto_create: true
});
// Use the components to build a custom form
document.getElementById("form-jwt").value = formComponents.jwt;
document.getElementById("form-endpoint").value = formComponents.endpoint;
document.getElementById("form-formData").value = formComponents.formData;
document.getElementById("my-form").submit();getMemberships
Retrieves a list of course memberships for the current context. This method requires either LTIK or Service Key authentication.
Parameters
|Parameter|Type|Required|Description| |---|---|---|---| |filters|MembershipsFilter|No|Query parameters to filter the memberships results|
Filter Options
The MembershipsFilter object can include:
role: Filter members by specific rolelimit: Maximum number of results to returnoffset: Number of results to skipurl: Filter by specific membership URL
Return Type
Returns a Promise that resolves to a MembershipContainer object with:
members: Array of membership objects containing user informationcontext: Course context informationtotalItems: Total number of available itemslimit: Current page size limitoffset: Current page offset
Example Usage
// Get all memberships
const allMemberships = await client.getMemberships();
// Get memberships with filters
const filteredMemberships = await client.getMemberships({
role: "Learner",
limit: 10,
offset: 0
});
// Access membership data
console.log(filteredMemberships.members); // Array of members
console.log(filteredMemberships.totalItems); // Total count
console.log(filteredMemberships.context); // Course contextgetLineItems
Retrieves a list of line items (gradebook columns) for the current context. This method requires either LTIK or Service Key authentication.
Parameters
|Parameter|Type|Required|Description| |---|---|---|---| |filters|LineItemsFilter|No|Query parameters to filter the line items results|
Filter Options
The LineItemsFilter object can include:
tag: Filter by specific tagresourceId: Filter by resource identifierresourceLinkId: Filter by resource link IDlimit: Maximum number of results to returnoffset: Number of results to skipurl: Filter by specific line item URL
Return Type
Returns a Promise that resolves to a LineItemContainer object with:
lineItems: Array of line item objects containing:id: Unique identifierscoreMaximum: Maximum possible scorelabel: Display labeltag: Optional tag for categorizationresourceId: Associated resource identifierresourceLinkId: Associated resource link IDstartDateTime: Optional start date/timeendDateTime: Optional end date/time
totalItems: Total number of available itemslimit: Current page size limitoffset: Current page offset
Example Usage
// Get all line items
const allLineItems = await client.getLineItems();
// Get line items with filters
const filteredLineItems = await client.getLineItems({
tag: "midterm",
limit: 25,
offset: 0
});
// Access line items data
console.log(filteredLineItems.lineItems); // Array of line items
console.log(filteredLineItems.totalItems); // Total countcreateLineItem
Creates a new gradebook column (line item) in the platform's gradebook. This method requires either LTIK or Service Key authentication.
Parameters
|Parameter|Type|Required|Description| |---|---|---|---| |lineItem|PartialLineItem|Yes|The line item details to create|
PartialLineItem Properties
scoreMaximum: Maximum score value (number)label: Display name for the column (string)resourceId: Unique identifier for the resource (string)tag: Custom tag for the line item (string)resourceLinkId: Associated resource link identifier (string)startDateTime: Start date for the assignment (string, ISO format)endDateTime: Due date for the assignment (string, ISO format)
Return Type
Returns a Promise that resolves to a LineItem object containing:
id: Unique identifier of the created line itemscoreMaximum: Maximum score valuelabel: Display nameresourceId: Resource identifiertag: Custom tagresourceLinkId: Associated resource link IDstartDateTime: Start dateendDateTime: Due dateurl: API endpoint URL for this line item
Example Usage
// Create a basic line item
const newLineItem = await client.createLineItem({
scoreMaximum: 100,
label: "Midterm Exam",
resourceId: "exam-001"
});
// Create a line item with all properties
const detailedLineItem = await client.createLineItem({
scoreMaximum: 100,
label: "Final Project",
resourceId: "project-001",
tag: "final-assessment",
resourceLinkId: "link-123",
startDateTime: "2024-01-01T00:00:00Z",
endDateTime: "2024-01-15T23:59:59Z"
});
// Access the created line item data
console.log(newLineItem.id);
console.log(newLineItem.url);getLineItem
Retrieves a specific line item (gradebook column) by its ID. This method requires either LTIK or Service Key authentication.
Parameters
|Parameter|Type|Required|Description| |---|---|---|---| |id|string|Yes|The unique identifier of the line item to retrieve|
Return Type
Returns a Promise that resolves to a LineItem object containing:
id: Unique identifier for the line itemscoreMaximum: Maximum possible score valuelabel: Display label for the line itemtag: Optional tag for categorizationresourceId: Optional identifier for associated resourceresourceLinkId: Optional identifier for resource linkstartDateTime: Optional start date/time for the line itemendDateTime: Optional end date/time for the line itemurl: URL for accessing the line item
Example Usage
// Get a single line item by ID
const lineItem = await client.getLineItem("12345");
// Access line item properties
console.log(lineItem.id);
console.log(lineItem.scoreMaximum);
console.log(lineItem.label);
// Example with error handling
try {
const lineItem = await client.getLineItem("12345");
// Process line item data
} catch (error) {
// Handle any errors
console.error("Failed to fetch line item:", error);
}updateLineItem
Updates an existing line item (gradebook column) in the platform. This method requires either LTIK or Service Key authentication.
Parameters
|Parameter|Type|Required|Description| |---|---|---|---| |id|string|Yes|The unique identifier of the line item to update| |lineItem|PartialLineItem|Yes|The line item properties to update|
PartialLineItem Properties
The PartialLineItem object can include:
scoreMaximum: Maximum score valuelabel: Display name of the line itemresourceId: Unique resource identifiertag: Custom tag for the line itemstartDateTime: Start date/time for the line itemendDateTime: End date/time for the line itemresourceLinkId: Associated resource link identifier
Return Type
Returns a Promise that resolves to a LineItem object containing:
id: Unique identifierscoreMaximum: Maximum score valuelabel: Display nameresourceId: Resource identifiertag: Custom tagstartDateTime: Start date/timeendDateTime: End date/timeresourceLinkId: Resource link identifier
Example Usage
// Update a line item
const updatedLineItem = await client.updateLineItem("item-123", {
scoreMaximum: 100,
label: "Updated Assignment",
tag: "quiz",
startDateTime: "2023-01-01T00:00:00Z",
endDateTime: "2023-12-31T23:59:59Z"
});
// Access updated line item data
console.log(updatedLineItem.id);
console.log(updatedLineItem.label);
console.log(updatedLineItem.scoreMaximum);deleteLineItem
Deletes a specific line item (gradebook column) from the platform. This method requires either LTIK or Service Key authentication.
Notes:
- The line item ID must be URL-encoded before being sent to the API
- Once deleted, the line item and its associated scores cannot be recovered
- The deletion will fail if you don't have sufficient permissions or if the line item doesn't exist
Parameters
|Parameter|Type|Required|Description| |---|---|---|---| |id|string|Yes|The unique identifier of the line item to delete|
Return Type
Returns a Promise that resolves to void - no content is returned upon successful deletion.
Example Usage
// Delete a line item by ID
await client.deleteLineItem("12345");
// Delete with error handling
try {
await client.deleteLineItem("12345");
console.log("Line item successfully deleted");
} catch (error) {
console.error("Failed to delete line item:", error);
}submitScore
Submits a score for a specific line item in the gradebook. This method requires either LTIK or Service Key authentication.
Parameters
|Parameter|Type|Required|Description| |---|---|---|---| |lineItemId|string|Yes|The ID of the line item to submit the score for| |score|Score|Yes|The score object containing the grade details|
Score Object Properties
The Score object must include:
userId: (string) The ID of the user receiving the gradescoreGiven: (number) The score awarded to the userscoreMaximum: (number) The maximum possible scoreactivityProgress: (string) Progress status (e.g., "Completed", "InProgress")gradingProgress: (string) Grading status (e.g., "FullyGraded", "Pending")comment: (string, optional) Feedback comment for the submission
Return Type
Returns a Promise that resolves to void
Example Usage
// Submit a basic score
await client.submitScore("lineitem-123", {
userId: "student-456",
scoreGiven: 85,
scoreMaximum: 100,
activityProgress: "Completed",
gradingProgress: "FullyGraded",
comment: "Excellent work on the assignment!"
});
// Submit a score with minimum required fields
await client.submitScore("lineitem-789", {
userId: "student-101",
scoreGiven: 42,
scoreMaximum: 50,
activityProgress: "Completed",
gradingProgress: "FullyGraded"
});getScores
Retrieves scores for a specific line item. This method requires either LTIK or Service Key authentication.
Parameters
|Parameter|Type|Required|Description| |---|---|---|---| |lineItemId|string|Yes|The unique identifier of the line item to retrieve scores for| |filters|ResultsFilter|No|Query parameters to filter the scores results|
Filter Options
The ResultsFilter object can include:
limit: Maximum number of results to returnoffset: Number of results to skipuserId: Filter scores for a specific userurl: Filter by specific score URLtimestamp: Filter scores by submission timestamp
Return Type
Returns a Promise that resolves to a ResultContainer object with:
results: Array of score results containing:userId: The user ID associated with the scorescoreGiven: The score value assignedscoreMaximum: The maximum possible scorecomment: Any feedback provided with the scoretimestamp: When the score was submittedactivityProgress: Status of the activity (Initialized, Started, InProgress, Submitted, Completed)gradingProgress: Status of grading (NotReady, Failed, Pending, PendingManual, FullyGraded)
totalItems: Total number of available resultslimit: Current page size limitoffset: Current page offset
Example Usage
// Get all scores for a line item
const allScores = await client.getScores("lineitem-123");
// Get scores with filters
const filteredScores = await client.getScores("lineitem-123", {
limit: 10,
offset: 0,
userId: "student-456"
});
// Access score data
console.log(filteredScores.results); // Array of score results
console.log(filteredScores.totalItems); // Total count of scoresgetRegistrationRequest
Retrieves a registration request by its ID. This method uses API Key authentication and returns the formatted registration request data.
Parameters
|Parameter|Type|Required|Description| |---|---|---|---| |id|string|Yes|The unique identifier of the registration request|
Return Type
Returns a Promise that resolves to a RegistrationRequest object containing:
url: Platform registration URLfamilyCode: Platform family code identifierversion: Platform versionsupportedScopes: Array of supported OAuth scopessupportedMessages: Array of supported message types and their placementstype: LTI launch typeplacements: Optional array of supported placement locations
Example Usage
// Get a registration request
const registrationRequest = await client.getRegistrationRequest("reg-123");
// Access registration request data
console.log(registrationRequest.url); // Platform registration URL
console.log(registrationRequest.familyCode); // Platform family code
console.log(registrationRequest.supportedScopes); // Array of supported scopes
console.log(registrationRequest.supportedMessages); // Array of supported message configurationsgetRawRegistrationRequest
Retrieves the raw registration request data for a specific registration ID. This method uses API Key authentication and returns the unprocessed registration request details directly from the platform.
Parameters
|Parameter|Type|Required|Description| |---|---|---|---| |id|string|Yes|The unique identifier of the registration request|
Return Type
Returns a Promise that resolves to a RawRegistrationRequest object containing:
url: Platform registration URLfamilyCode: Platform family code identifierversion: Platform versionsupportedScopes: Array of supported OAuth scopessupportedMessages: Array of supported message types and their placementstype: LTI launch typeplacements: Optional array of supported placement locations
Example Usage
// Initialize client with API key
const client = new LaunchClient({
apiKey: "your-api-key",
domain: "your-domain"
});
// Get raw registration request
const rawRegistration = await client.getRawRegistrationRequest("registration-id");
// Access registration data
console.log(rawRegistration.url);
console.log(rawRegistration.familyCode);
console.log(rawRegistration.supportedScopes);
console.log(rawRegistration.supportedMessages);completeRegistrationRequest
Completes a platform registration request by providing the necessary configuration options. This method uses API Key authentication.
Parameters
|Parameter|Type|Required|Description| |---|---|---|---| |id|string|Yes|The registration request identifier| |options|RegistrationOptions|Yes|Configuration options for completing the registration|
Registration Options
The RegistrationOptions object must include:
url: The tool's launch URLfamilyCode: Product family code identifierversion: Tool version stringsupportedScopes: Array of supported LTI scopessupportedMessages: Array of supported message types and their placementstype: LTI launch typeplacements: Optional array of placement locations
Return Type
Returns a Promise that resolves to a RegistrationCompletion object containing registration details and credentials.
Example Usage
// Complete a registration request
const registration = await client.completeRegistrationRequest("reg-123", {
url: "https://tool.example.com/launch",
familyCode: "my-tool",
version: "1.0.0",
supportedScopes: [
"https://purl.imsglobal.org/spec/lti-ags/scope/score",
"https://purl.imsglobal.org/spec/lti-nrps/scope/contextmembership.readonly"
],
supportedMessages: [
{
type: "LtiResourceLinkRequest",
placements: ["ContentArea", "CourseNavigation"]
}
]
});
// Access registration completion data
console.log(registration.clientId);
console.log(registration.deploymentId);
console.log(registration.toolConfiguration);getPlatforms
Retrieves a list of registered LTI platforms. This method requires API Key authentication.
Parameters
|Parameter|Type|Required|Description| |---|---|---|---| |filters|PlatformsFilter|Yes|Query parameters to filter the platforms results|
Filter Options
The PlatformsFilter object can include:
limit: Maximum number of results to return per pageoffset: Number of results to skip for paginationactive: Filter platforms by active status (true/false)search: Search platforms by name or URLversion: Filter by LTI version
Return Type
Returns a Promise that resolves to a PlatformContainer object with:
platforms: Array of platform objects containing configuration and statustotalItems: Total number of available platformslimit: Current page size limitoffset: Current page offset
Each platform object includes:
id: Unique platform identifiername: Platform nameurl: Platform URLclientId: Client ID for LTI 1.3active: Platform activation statusversion: LTI versioncreatedAt: Platform registration dateupdatedAt: Last update date
Example Usage
// Get platforms with basic filtering
const platforms = await client.getPlatforms({
limit: 20,
offset: 0
});
// Get platforms with advanced filtering
const filteredPlatforms = await client.getPlatforms({
limit: 10,
offset: 0,
active: true,
search: "canvas",
version: "1.3.0"
});
// Access platform data
console.log(filteredPlatforms.platforms); // Array of platform objects
console.log(filteredPlatforms.totalItems); // Total countgetPlatform
Retrieves detailed information about a specific LTI platform by its ID. This method uses API Key authentication.
Parameters
|Parameter|Type|Required|Description| |---|---|---|---| |id|string|Yes|The unique identifier of the platform to retrieve|
Return Type
Returns a Promise that resolves to a Platform object containing:
id: Unique platform identifiername: Platform nameurl: Platform URLclientId: OAuth2 client IDdeploymentId: Platform deployment IDauthenticationEndpoint: OAuth2 authentication endpointaccesstokenEndpoint: OAuth2 token endpointjwksEndpoint: JWKS endpoint for key verificationactive: Platform activation statuscreatedAt: Platform creation timestampupdatedAt: Platform last update timestamp
Example Usage
// Fetch a specific platform
const platformId = "platform-123";
const platform = await client.getPlatform(platformId);
// Access platform details
console.log(platform.name);
console.log(platform.url);
console.log(platform.active);
console.log(platform.clientId);
console.log(platform.deploymentId);registerPlatform
Registers a new LTI platform in the system. This method requires API Key authentication.
Parameters
|Parameter|Type|Required|Description| |---|---|---|---| |platform|PartialPlatform|Yes|Platform configuration object containing the registration details|
Platform Configuration Options
The PartialPlatform object can include:
name: Platform display nameurl: Platform base URLclientId: OAuth2 client IDdeploymentId: Platform deployment IDauthenticationEndpoint: OAuth2 authentication endpointaccesstokenEndpoint: OAuth2 token endpointjwksEndpoint: Platform JWKS endpointoAuth2Flow: OAuth2 flow typeRSAKey: RSA key configurationcustomParameters: Additional custom parameters
Return Type
Returns a Promise that resolves to a Platform object containing:
id: Unique platform identifiername: Platform nameurl: Platform URLclientId: OAuth2 client IDdeploymentId: Platform deployment IDstatus: Platform statuscreatedAt: Creation timestampupdatedAt: Last update timestamp
Example Usage
// Register a new platform
const newPlatform = await client.registerPlatform({
name: "Canvas LMS",
url: "https://canvas.instructure.com",
clientId: "12345",
deploymentId: "deployment_123",
authenticationEndpoint: "https://canvas.instructure.com/auth",
accesstokenEndpoint: "https://canvas.instructure.com/token",
jwksEndpoint: "https://canvas.instructure.com/.well-known/jwks.json"
});
// Access platform data
console.log(newPlatform.id);
console.log(newPlatform.status);
console.log(newPlatform.createdAt);updatePlatform
Updates an existing LTI platform configuration. This method uses API Key authentication.
Parameters
| Parameter | Type | Required | Description | | --------- | --------------- | -------- | ----------------------------------------------- | | id | string | Yes | The unique identifier of the platform to update | | platform | PartialPlatform | Yes | Platform configuration properties to update |
Platform Properties
The PartialPlatform object can include:
name: Platform display nameissuer: Platform issuer URLauthenticationEndpoint: OAuth2 authentication endpointaccessTokenEndpoint: OAuth2 token endpointjwksEndpoint: JSON Web Key Set endpointclientId: Tool client identifierdeploymentId: Platform deployment identifierkeyId: Platform key identifierpublicKey: Platform public keyprivateKey: Platform private key
Return Type
Returns a Promise that resolves to a Platform object containing:
id: Unique platform identifiername: Platform nameissuer: Platform issuer URLclientId: Tool client identifierdeploymentId: Platform deployment identifierauthenticationEndpoint: OAuth2 authentication endpointaccessTokenEndpoint: OAuth2 token endpointjwksEndpoint: JSON Web Key Set endpointactive: Platform activation statuscreatedAt: Creation timestampupdatedAt: Last update timestamp
Example Usage
// Update platform configuration
const updatedPlatform = await client.updatePlatform("platform-123", {
name: "Updated Canvas Instance",
clientId: "new-client-id",
deploymentId: "new-deployment-id",
authenticationEndpoint: "https://canvas.example.com/auth"
});
// Access updated platform data
console.log(updatedPlatform.name);
console.log(updatedPlatform.active);
console.log(updatedPlatform.updatedAt);deletePlatform
Permanently removes a platform integration from your LTIaaS account. This method requires API Key authentication.
Notes:
- This action cannot be undone
- All associated data with the platform will be removed
- Active integrations using this platform will stop working
Parameters
|Parameter|Type|Required|Description| |---|---|---|---| |id|string|Yes|The unique identifier of the platform to delete|
Return Type
Returns a Promise that resolves to void. The platform will be permanently deleted if the operation is successful.
Example Usage
// Delete a platform by ID
await client.deletePlatform("platform-123");
// Delete with error handling
try {
await client.deletePlatform("platform-123");
console.log("Platform successfully deleted");
} catch (error) {
console.error("Failed to delete platform:", error);
}activatePlatform
Activates a registered LTI platform, enabling it to process launches and service requests. This method requires API Key authentication.
Parameters
|Parameter|Type|Required|Description| |---|---|---|---| |id|string|Yes|The unique identifier of the platform to activate|
Return Type
Returns a Promise that resolves to void. The operation is considered successful if no error is thrown.
Note:
- The platform must be registered before it can be activated
- Only inactive platforms can be activated
- This operation is idempotent - activating an already active platform will not cause an error
Example Usage
// Activate a platform
await client.activatePlatform("platform-123");
// Can be used in combination with platform registration
const platform = await client.registerPlatform({
name: "Canvas Instance",
url: "https://canvas.instructure.com"
});
await client.activatePlatform(platform.id);deactivatePlatform
Deactivates a specific LTI platform integration, preventing further launches and interactions. This method requires API Key authentication.
Notes:
- The platform can be reactivated using the
activatePlatformmethod - Deactivating a platform will immediately stop all active LTI launches
- The platform ID must be valid and exist in your LTIaaS account
Parameters
|Parameter|Type|Required|Description| |---|---|---|---| |id|string|Yes|The unique identifier of the platform to deactivate|
Return Type
Returns a Promise that resolves to void. The operation is considered successful if no error is thrown.
Example Usage
// Deactivate a platform
await client.deactivatePlatform("platform-123");
