Zapytania o dane wtyczek
Zapytania o dane wtyczekMasterStudy LMS

MasterStudy LMS

Przykłady queries do interakcji z danymi wtyczki MasterStudy LMS.

Pobieranie danych LMS

Ta query pobiera tytuł i treść dla danego kursu:

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

Aktualizowanie danych LMS

Ta query aktualizuje tytuł i treść dla danego kursu:

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
      }
    }
  }
}