Skip to main content

Fetching Content with GraphQL

Patterns for retrieving Courses, Videos, Blogs, ILTs, and Learning Paths.

Thought Industries offers several content types — Courses, Videos, Blogs, SCORMs, Articles, and more. While they appear differently in the admin, many share the same underlying structure. Understanding that structure is key to fetching the right data.

Courses

Courses are one of the most complex content types. Each course belongs to a courseGroup. Courses have sections, sections have lessons, and lessons have topics (quizzes, tests, text pages, etc.).

The CatalogContent Query

Use this to get the IDs of courses in your learning instance — typically when building a Catalog Page.

CatalogContent(page: 1) {
  contentItems {
    title
    displayCourse  # pass this ID to CourseById
  }
}

The CourseById Query

Use IDs from CatalogContent to fetch sections, lessons, and topics for a specific course.

CourseById(id: "sample-id") {
  Sections {
    Lessons {
      Topics {
        ...on ArticlePage {
          title
          id
          type
        }
        ...on QuizPage {
          title
          id
          type
        }
      }
    }
  }
}

The Pages Query

With topic IDs in hand, call Pages for richer data — e.g. quiz questions, answers, and timing.

Pages(identifiers: [String!]!) {
  ... on QuizPage {
    title
    questions {
      body
      choices {
        value
        correct
      }
    }
  }
}

Videos, Blogs, Articles

Under the hood, Videos, Blogs, and Articles are also stored as course objects with a single topic. Follow the same pattern: CatalogContentCourseByIdPages. All three are exposed through the ArticlePage type.

query Pages($identifiers: [String!]!) {
  Pages(identifiers: $identifiers) {
    ... on ArticlePage {
      videoAsset
      languages {
        language
        label
        title
        subtitle
        body
        copyright
      }
    }
  }
}

ILTs

Instructor Led Training is stored as courseGroup objects. Most ILT data lives at the CourseById level — no Pages query needed. One ILT can have multiple sessions: a parent courseGroup with child courses for each session.

query CourseById($id: ID!) {
  CourseById(id: $id) {
    title
    slug
    courseGroup {
      description
      asset
      courses {
        title
        courseStartDate
        courseEndDate
      }
    }
  }
}

Learning Paths

The CatalogContent Query

Fetch every Learning Path in your instance with basic info like title and description.

CatalogContent(page: 1) {
  contentItems {
    title
    slug  # pass this to LearningPathBySlug
  }
}

The LearningPathBySlug Query

Fetch general and milestone-level info for a specific Learning Path.

query LearningPathBySlug($slug: Slug!) {
  LearningPathBySlug(slug: $slug) {
    milestones {
      name
      id
      contentItems {
        id
        title
        kind
      }
    }
  }
}

The Milestone Query

Fetch info about a single Milestone rather than all of them at once.

query Milestone($id: ID!) {
  Milestone(id: $id) {
    name
    id
    contentItems {
      id
      title
      kind
    }
  }
}