Course Templates

Search

The following example fetches the first page of Course Templates whose code begins with ABC:

Example

query {
  courseTemplates(filters: [
    {field: code, operation: like, value: "ABC%"}
  ]) {
    edges {
      node {
        id
        code 
        title
      }
    }
  }
}

For the full range of available filters see the CourseTemplateField API Reference.

Create

The following example creates a new course template with the specified code and title:

Example

mutation{
  courseTemplate{
    create(input:{
      code:"ABC-123"
      title:"My New Course"
    }) {
      courseTemplate{
        id
        lifecycleState
      }
      errors{
        label 
        message 
        value
      }
    }
  }
}

For the full range of available create parameters see the CourseTemplateCreateInput API Reference.

The response shows that the new Course Template lifecycle state is draft:

{
  "data": {
    "courseTemplate": {
      "create": {
        "courseTemplate": {
          "id": "Q291cnNlVGVtcGxhdGU6MTE=",
          "lifecycleState": "draft"
        },
        "errors": []
      }
    }
  }
}

Update

For the full range of available update parameters see the CourseTemplateUpdateInput API Reference.

Publish

The following example publishes the Course Template by updating its lifecycleState:

Example

mutation{
  courseTemplate{
    update(
      courseTemplateId:"Q291cnNlVGVtcGxhdGU6MTE="
      input:{
        lifecycleState: published
      }) {
      courseTemplate{
        id
        lifecycleState
      }
      errors{
        label 
        message 
        value
      }
    }
  }
}

Archive

Replace published with archived in the above example.