Blueprint Courses API

Configure blueprint courses

A BlueprintTemplate object looks like:

{
  // The ID of the template.
  "id": 1,
  // The ID of the Course the template belongs to.
  "course_id": 2,
  // Time when the last export was completed
  "last_export_completed_at": "2013-08-28T23:59:00-06:00",
  // Number of associated courses for the template
  "associated_course_count": 3,
  // Details of the latest migration
  "latest_migration": null
}

A BlueprintMigration object looks like:

{
  // The ID of the migration.
  "id": 1,
  // The ID of the template the migration belongs to. Only present when querying a
  // blueprint course.
  "template_id": 2,
  // The ID of the associated course's blueprint subscription. Only present when
  // querying a course associated with a blueprint.
  "subscription_id": 101,
  // The ID of the user who queued the migration.
  "user_id": 3,
  // Current state of the content migration: queued, exporting, imports_queued,
  // completed, exports_failed, imports_failed
  "workflow_state": "running",
  // Time when the migration was queued
  "created_at": "2013-08-28T23:59:00-06:00",
  // Time when the exports begun
  "exports_started_at": "2013-08-28T23:59:00-06:00",
  // Time when the exports were completed and imports were queued
  "imports_queued_at": "2013-08-28T23:59:00-06:00",
  // Time when the imports were completed
  "imports_completed_at": "2013-08-28T23:59:00-06:00",
  // User-specified comment describing changes made in this operation
  "comment": "Fixed spelling in question 3 of midterm exam"
}

A BlueprintRestriction object looks like:

// A set of restrictions on editing for copied objects in associated courses
{
  // Restriction on main content (e.g. title, description).
  "content": true,
  // Restriction on points possible for assignments and graded learning objects
  "points": true,
  // Restriction on due dates for assignments and graded learning objects
  "due_dates": false,
  // Restriction on availability dates for an object
  "availability_dates": true
}

A ChangeRecord object looks like:

// Describes a learning object change propagated to associated courses from a
// blueprint course
{
  // The ID of the learning object that was changed in the blueprint course.
  "asset_id": 2,
  // The type of the learning object that was changed in the blueprint course. 
  // One of 'assignment', 'attachment', 'discussion_topic', 'external_tool',
  // 'quiz', 'wiki_page', 'syllabus', or 'settings'.  For 'syllabus' or
  // 'settings', the asset_id is the course id.
  "asset_type": "assignment",
  // The name of the learning object that was changed in the blueprint course.
  "asset_name": "Some Assignment",
  // The type of change; one of 'created', 'updated', 'deleted'
  "change_type": "created",
  // The URL of the changed object
  "html_url": "https://canvas.example.com/courses/101/assignments/2",
  // Whether the object is locked in the blueprint
  "locked": false,
  // A list of ExceptionRecords for linked courses that did not receive this
  // update.
  "exceptions": [{"course_id":101,"conflicting_changes":["points"]}]
}

An ExceptionRecord object looks like:

// Lists associated courses that did not receive a change propagated from a
// blueprint
{
  // The ID of the associated course
  "course_id": 101,
  // A list of change classes in the associated course's copy of the item that
  // prevented a blueprint change from being applied. One or more of ['content',
  // 'points', 'due_dates', 'availability_dates'].
  "conflicting_changes": ["points"]
}

A BlueprintSubscription object looks like:

// Associates a course with a blueprint
{
  // The ID of the blueprint course subscription
  "id": 101,
  // The ID of the blueprint template the associated course is subscribed to
  "template_id": 1,
  // The blueprint course subscribed to
  "blueprint_course": {"id":2,"name":"Biology 100 Blueprint","course_code":"BIOL 100 BP","term_name":"Default term"}
}

Get blueprint information MasterCourses::MasterTemplatesController#show

GET /api/v1/courses/:course_id/blueprint_templates/:template_id

Scope: url:GET|/api/v1/courses/:course_id/blueprint_templates/:template_id

Using 'default' as the template_id should suffice for the current implmentation (as there should be only one template per course). However, using specific template ids may become necessary in the future

Example Request:

curl https://<canvas>/api/v1/courses/1/blueprint_templates/default \
  -H 'Authorization: Bearer <ACCESS_TOKEN>'
Returns a BlueprintTemplate

Get associated course information MasterCourses::MasterTemplatesController#associated_courses

GET /api/v1/courses/:course_id/blueprint_templates/:template_id/associated_courses

Scope: url:GET|/api/v1/courses/:course_id/blueprint_templates/:template_id/associated_courses

Returns a list of courses that are configured to receive updates from this blueprint

Example Request:

curl https://<canvas>/api/v1/courses/1/blueprint_templates/default/associated_courses \
  -H 'Authorization: Bearer <ACCESS_TOKEN>'
Returns a list of Courses

Update associated courses MasterCourses::MasterTemplatesController#update_associations

PUT /api/v1/courses/:course_id/blueprint_templates/:template_id/update_associations

Scope: url:PUT|/api/v1/courses/:course_id/blueprint_templates/:template_id/update_associations

Send a list of course ids to add or remove new associations for the template. Cannot add courses that do not belong to the blueprint course's account. Also cannot add other blueprint courses or courses that already have an association with another blueprint course.

After associating new courses, start a sync to populate their contents from the blueprint.

Request Parameters:

Parameter Type Description
course_ids_to_add Array

Courses to add as associated courses

course_ids_to_remove Array

Courses to remove as associated courses

Example Request:

curl https://<canvas>/api/v1/courses/1/blueprint_templates/default/update_associations \
-X PUT \
-H 'Authorization: Bearer <token>' \
-d 'course_ids_to_add[]=1' \
-d 'course_ids_to_remove[]=2' \

Begin a migration to push to associated courses MasterCourses::MasterTemplatesController#queue_migration

POST /api/v1/courses/:course_id/blueprint_templates/:template_id/migrations

Scope: url:POST|/api/v1/courses/:course_id/blueprint_templates/:template_id/migrations

Begins a migration to push recently updated content to all associated courses. Only one migration can be running at a time.

Request Parameters:

Parameter Type Description
comment string

An optional comment to be included in the sync history.

send_notification boolean

Send a notification to the calling user when the sync completes.

copy_settings boolean

Whether course settings should be copied over to associated courses. Defaults to true for newly associated courses.

publish_after_initial_sync boolean

If set, newly associated courses will be automatically published after the sync completes

Example Request:

curl https://<canvas>/api/v1/courses/1/blueprint_templates/default/migrations \
-X POST \
-F 'comment=Fixed spelling in question 3 of midterm exam' \
-F 'send_notification=true' \
-H 'Authorization: Bearer <token>'
Returns a BlueprintMigration

Set or remove restrictions on a blueprint course object MasterCourses::MasterTemplatesController#restrict_item

PUT /api/v1/courses/:course_id/blueprint_templates/:template_id/restrict_item

Scope: url:PUT|/api/v1/courses/:course_id/blueprint_templates/:template_id/restrict_item

If a blueprint course object is restricted, editing will be limited for copies in associated courses.

Request Parameters:

Parameter Type Description
content_type string

The type of the object.

Allowed values: assignment, attachment, discussion_topic, external_tool, quiz, wiki_page

content_id integer

The ID of the object.

restricted boolean

Whether to apply restrictions.

restrictions BlueprintRestriction

(Optional) If the object is restricted, this specifies a set of restrictions. If not specified, the course-level restrictions will be used. See Course API update documentation

Example Request:

curl https://<canvas>/api/v1/courses/1/blueprint_templates/default/restrict_item \
-X PUT \
-H 'Authorization: Bearer <token>' \
-d 'content_type=assignment' \
-d 'content_id=2' \
-d 'restricted=true'

Get unsynced changes MasterCourses::MasterTemplatesController#unsynced_changes

GET /api/v1/courses/:course_id/blueprint_templates/:template_id/unsynced_changes

Scope: url:GET|/api/v1/courses/:course_id/blueprint_templates/:template_id/unsynced_changes

Retrieve a list of learning objects that have changed since the last blueprint sync operation.

Returns a list of ChangeRecords

List blueprint migrations MasterCourses::MasterTemplatesController#migrations_index

GET /api/v1/courses/:course_id/blueprint_templates/:template_id/migrations

Scope: url:GET|/api/v1/courses/:course_id/blueprint_templates/:template_id/migrations

Shows a paginated list of migrations for the template, starting with the most recent. This endpoint can be called on a blueprint course. See also the associated course side.

Example Request:

curl https://<canvas>/api/v1/courses/1/blueprint_templates/default/migrations \
-H 'Authorization: Bearer <token>'
Returns a list of BlueprintMigrations

Show a blueprint migration MasterCourses::MasterTemplatesController#migrations_show

GET /api/v1/courses/:course_id/blueprint_templates/:template_id/migrations/:id

Scope: url:GET|/api/v1/courses/:course_id/blueprint_templates/:template_id/migrations/:id

Shows the status of a migration. This endpoint can be called on a blueprint course. See also the associated course side.

Example Request:

curl https://<canvas>/api/v1/courses/1/blueprint_templates/default/migrations/:id \
-H 'Authorization: Bearer <token>'
Returns a BlueprintMigration

Get migration details MasterCourses::MasterTemplatesController#migration_details

GET /api/v1/courses/:course_id/blueprint_templates/:template_id/migrations/:id/details

Scope: url:GET|/api/v1/courses/:course_id/blueprint_templates/:template_id/migrations/:id/details

Show the changes that were propagated in a blueprint migration. This endpoint can be called on a blueprint course. See also the associated course side.

Example Request:

curl https://<canvas>/api/v1/courses/1/blueprint_templates/default/migrations/2/details \
-H 'Authorization: Bearer <token>'
Returns a list of ChangeRecords

List blueprint subscriptions MasterCourses::MasterTemplatesController#subscriptions_index

GET /api/v1/courses/:course_id/blueprint_subscriptions

Scope: url:GET|/api/v1/courses/:course_id/blueprint_subscriptions

Returns a list of blueprint subscriptions for the given course. (Currently a course may have no more than one.)

Example Request:

curl https://<canvas>/api/v1/courses/2/blueprint_subscriptions \
-H 'Authorization: Bearer <token>'
Returns a list of BlueprintSubscriptions

List blueprint imports MasterCourses::MasterTemplatesController#imports_index

GET /api/v1/courses/:course_id/blueprint_subscriptions/:subscription_id/migrations

Scope: url:GET|/api/v1/courses/:course_id/blueprint_subscriptions/:subscription_id/migrations

Shows a paginated list of migrations imported into a course associated with a blueprint, starting with the most recent. See also the blueprint course side.

Use 'default' as the subscription_id to use the currently active blueprint subscription.

Example Request:

curl https://<canvas>/api/v1/courses/2/blueprint_subscriptions/default/migrations \
-H 'Authorization: Bearer <token>'
Returns a list of BlueprintMigrations

Show a blueprint import MasterCourses::MasterTemplatesController#imports_show

GET /api/v1/courses/:course_id/blueprint_subscriptions/:subscription_id/migrations/:id

Scope: url:GET|/api/v1/courses/:course_id/blueprint_subscriptions/:subscription_id/migrations/:id

Shows the status of an import into a course associated with a blueprint. See also the blueprint course side.

Example Request:

curl https://<canvas>/api/v1/courses/2/blueprint_subscriptions/default/migrations/:id \
-H 'Authorization: Bearer <token>'
Returns a BlueprintMigration

Get import details MasterCourses::MasterTemplatesController#import_details

GET /api/v1/courses/:course_id/blueprint_subscriptions/:subscription_id/migrations/:id/details

Scope: url:GET|/api/v1/courses/:course_id/blueprint_subscriptions/:subscription_id/migrations/:id/details

Show the changes that were propagated to a course associated with a blueprint. See also the blueprint course side.

Example Request:

curl https://<canvas>/api/v1/courses/2/blueprint_subscriptions/default/7/details \
-H 'Authorization: Bearer <token>'
Returns a list of ChangeRecords