Modules API

Modules are collections of learning materials useful for organizing courses and optionally providing a linear flow through them. Module items can be accessed linearly or sequentially depending on module configuration. Items can be unlocked by various criteria such as reading a page or achieving a minimum score on a quiz. Modules themselves can be unlocked by the completion of other Modules.

A Module object looks like:

{
  // the unique identifier for the module
  id: 123,
  // the state of the module: active, deleted
  workflow_state: active,

  // the position of this module in the course (1-based)
  position: 2,

  // the name of this module
  name: "Imaginary Numbers and You",

  // (Optional) the date this module will unlock
  unlock_at: "2012-12-31T06:00:00-06:00",

  // Whether module items must be unlocked in order
  require_sequential_progress: true,

  // IDs of Modules that must be completed before this one is unlocked
  prerequisite_module_ids: [121, 122],

  // The state of this Module for the calling user
  // one of 'locked', 'unlocked', 'started', 'completed'
  // (Optional; present only if the caller is a student)
  state: 'started',

  // the date the calling user completed the module
  // (Optional; present only if the caller is a student)
  completed_at: nil
}
  

A Module Item object looks like:

{
  // the unique identifier for the module item
  id: 768,

  // the position of this item in the module (1-based)
  position: 1,

  // the title of this item
  title: "Square Roots: Irrational numbers or boxy vegetables?",

  // 0-based indent level; module items may be indented to show a hierarchy
  indent: 0,

  // the type of object referred to
  // one of "File", "Page", "Discussion", "Assignment", "Quiz", "SubHeader",
  // "ExternalUrl", "ExternalTool"
  type: "Assignment",

  // link to the item in Canvas
  html_url: "https://canvas.example.edu/courses/222/modules/items/768",

  // (Optional) link to the Canvas API object, if applicable
  url: "https://canvas.example.edu/api/v1/courses/222/assignments/987",

  // Completion requirement for this module item
  completion_requirement: {
    // one of "must_view", "must_submit", "must_contribute", "min_score"
    type: "min_score",

    // minimum score required to complete (only present when type == 'min_score')
    min_score: 10,

    // whether the calling user has met this requirement
    // (Optional; present only if the caller is a student)
    completed: true
  }
}
  

List modules ContextModulesApiController#index

GET /api/v1/courses/:course_id/modules

List the modules in a course

Example Request:

curl -H 'Authorization: Bearer <token>' \ 
     https://<canvas>/api/v1/courses/222/modules
Returns a list of Modules

Show module ContextModulesApiController#show

GET /api/v1/courses/:course_id/modules/:id

Get information about a single module

Example Request:

curl -H 'Authorization: Bearer <token>' \ 
     https://<canvas>/api/v1/courses/222/modules/123
Returns a Module

List module items ContextModulesApiController#list_module_items

GET /api/v1/courses/:course_id/modules/:module_id/items

List the items in a module

Example Request:

curl -H 'Authorization: Bearer <token>' \ 
     https://<canvas>/api/v1/courses/222/modules/123/items
Returns a list of Module Items

Show module item ContextModulesApiController#show_module_item

GET /api/v1/courses/:course_id/modules/:module_id/items/:id

Get information about a single module item

Example Request:

curl -H 'Authorization: Bearer <token>' \ 
     https://<canvas>/api/v1/courses/222/modules/123/items/768
Returns a Module Item