Truy vấn dữ liệu PluginMasterStudy LMS
MasterStudy LMS
Các ví dụ về queries để tương tác với dữ liệu từ plugin MasterStudy LMS.
Lấy dữ liệu LMS
Query này lấy tiêu đề và nội dung của một khóa học cụ thể:
query GetCourse($courseId: ID!) {
course: customPost(by: { id: $courseId }, customPostTypes: "stm-courses") {
id
title
content
}
}Cập nhật dữ liệu LMS
Query này cập nhật tiêu đề và nội dung của một khóa học cụ thể:
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
}
}
}
}