-
Notifications
You must be signed in to change notification settings - Fork 38
ApiCanvas
The following API hooks are supported for Canvas instances:
- User ID
- Course Groups service
- Membership service (including group information)
- Resource link level
- Context level
The implementation of the Membership service is more equivalent to the unofficial Memberships service extension which includes support for passing group membership data as well as enrolments.
The hooks should be registered as follows:
use ceLTIc\LTI\ApiHook\ApiHook;
use ceLTIc\LTI\Tool;
use ceLTIc\LTI\Context;
use ceLTIc\LTI\ResourceLink;
Tool::registerApiHook(ApiHook::$USER_ID_HOOK, 'canvas', 'ceLTIc\LTI\ApiHook\canvas\CanvasApiTool');
Context::registerApiHook(ApiHook::$GROUPS_SERVICE_HOOK, 'canvas', 'ceLTIc\LTI\ApiHook\canvas\CanvasApiContext');
Context::registerApiHook(ApiHook::$MEMBERSHIPS_SERVICE_HOOK, 'canvas', 'ceLTIc\LTI\ApiHook\canvas\CanvasApiContext');
ResourceLink::registerApiHook(ApiHook::$MEMBERSHIPS_SERVICE_HOOK, 'canvas', 'ceLTIc\LTI\ApiHook\canvas\CanvasApiResourceLink');
The following configuration options are supported:
Name | Required? | Description | Example |
---|---|---|---|
canvas.domain | Yes | The domain for the Canvas instance | myinst.instructure.com |
canvas.token | Yes | The web service access token authorising API requests | 12345~jhFJ9ao9GSBQDt5JIrGw3tfOEKzM1x8FQDI4k0SfTVrUzEQzCTUtoRwsH6XHgRZr |
canvas.group_set_prefix | No | A prefix which a grouping name must match before it is considered to be included in the results | Group |
canvas.per_page | No | Maximum number of records to be requested per message. The default is 50; use a value of 0 to remove the limit. | 100 |
These configuration options should be saved in the settings area of the platform record; for example:
$platform->setSetting('canvas.per_page', '75');
The options must be specified for each Canvas instance defined within the tool; at least the domain and access token will be different for each.
When using LTI 1.3, the Canvas course ID must also be explicitly passed as a custom parameter:
canvas_course_id=$Canvas.course.id
(This parameter is automatically included by Canvas for connections using earlier releases of LTI.)
The API hook uses the Canvas web services which are documented on the /doc/api/live
page of each site. The Canvas instance must be configured to authorise the access from the tool. This involves generating an access token for a user with sufficient privileges to access the enrolments for each course (see the Settings
page for the user).
The current implementation has the following limitations:
- The roles returned for each user do not include any administrator roles which may apply to the user and would be included in an LTI message.
- The value of the
lis_result_sourcedid
parameter is not included.
© 2022 Stephen P Vickers. All Rights Reserved.