Query Plugin Data
Query Plugin DataMasterStudy LMS

MasterStudy LMS

Examples of queries to interact with data from the MasterStudy LMS plugin.

Fetching LMS data

This query fetches the title and content for a given course:

query GetCourse($courseId: ID!) {
  course: customPost(by: { id: $courseId }, customPostTypes: "stm-courses") {
    id
    title
    content
  }
}

Updating LMS data

This query updates the title and content for a given course:

mutation UpdateCourse(
  $courseId: ID!
  $title: String!
  $content: String!
) {
  updateCustomPost(input: {
    id: $courseId,
    customPostType: "stm-courses"
    title: $title
    contentAs: {
      html: $content
    }
  }) {
    status
    errors {
      __typename
      ...on ErrorPayload {
        message
      }
    }
    customPost {
      __typename
      ...on CustomPost {
        id
        title
        content
      }
    }
  }
}