Comments & Discussion Threads
Fetch comments on videos and discussion threads on courses.
Fetching Comments on a Video
Call the Forums query first, then use the returned ID with the Comments query.
Step 1: Call Forums
query Forums(
$courseId: ID!
) {
Forums(
courseId: $courseId
) {
id # pass this into the Comments query
label
}
}
// SAMPLE VARIABLES
{
"courseId": "{{ ID from CatalogContent > displayCourse }}"
}Step 2: Call Comments
Use data returned from the Forums query.
query Comments(
$commentableId: ID!,
$commentableType: CommentableType!,
) {
Comments(
commentableId: $commentableId,
commentableType: $commentableType,
) {
comments {
asset
assetFileName
body
}
}
}
// SAMPLE VARIABLES
{
"commentableId": "{{ ID from Forums query }}",
"commentableType": "discussionBoard"
}Fetching Discussion Threads on a Course
To fetch a discussion thread on a course, call three queries consecutively: Forums, Threads, then Comments.
Step 1: Call Forums
query Forums(
$courseId: ID!
) {
Forums(
courseId: $courseId
) {
id # pass this into the Comments query
label
}
}
// SAMPLE VARIABLES
{
"courseId": "{{ ID from CatalogContent > displayCourse }}"
}Step 2: Call Threads
query Threads(
$forumId: ID!,
$courseId: ID!
) {
Threads(
forumId: $forumId,
courseId: $courseId
) {
threads {
body
id
}
}
}
// SAMPLE VARIABLES
{
"forumId": "{{ ID from Forums query }}",
"courseId": "{{ ID from CatalogContent > DisplayCourse }}"
}Step 3: Call Comments
Use data returned from the Threads query.
query Comments(
$commentableId: ID!,
$commentableType: CommentableType!,
) {
Comments(
commentableId: $commentableId,
commentableType: $commentableType,
) {
comments {
asset
assetFileName
body
}
}
}
// SAMPLE VARIABLES
{
"commentableId": "{{ ID from Forums query }}",
"commentableType": "discussionBoard"
}