Loopwise Docs
Admin APIQueries

Courses Query

How to query course data in the Loopwise Admin API

Note: The Loopwise Admin API is currently under development and not yet available for public use. This documentation is provided for preview purposes only.

Overview

The Courses API allows you to retrieve information about courses in your school. You can list all courses, get details for a specific course, and access related data.

Available Queries

courses

Returns a paginated list of courses for the school.

Parameters:

ParameterTypeDescription
filterCourseFilterFilter criteria (see Filtering)
pageIntPage number for pagination
perPageIntNumber of items per page (default: 20, max: 50)
limitIntAlternative to perPage

Returns:

  • CoursePage object with:
    • nodes: Array of Course objects
    • currentPage: Current page number
    • hasNextPage: Whether there are more pages
    • hasPreviousPage: Whether there are previous pages
    • nodesCount: Total number of items in the current page
    • totalPages: Total number of pages

Example:

query {
  courses(
    page: 1
    perPage: 10
  ) {
    nodes {
      id
      name
      description
      slug
      featured
    }
    currentPage
    hasNextPage
    totalPages
  }
}

Course Object

The Course object contains the following fields based on the schema:

FieldTypeDescription
idString!Unique identifier
nameString!Course name
slugString!URL-friendly identifier
descriptionStringCourse description
imageStringCourse image URL
featuredBoolean!Whether the course is featured
invisibleBoolean!Whether the course is hidden
publishedAtIntUnix timestamp when the course was published
courseTypeString!Possible values: paid, public_access, free_redeem or pre_order
contentTypeString!Content type of the course
templateString!Possible values: default, video_on_top
playerThemeString!Possible values: classic, theater
sections[Section!]!List of course sections
categories[Category!]List of course categories
tags[String!]List of course tags
lecturerLecturerPrimary lecturer
lecturers[Lecturer!]All lecturers for the course
assignments[Assignment!]List of course assignments
totalHoursFloatTotal duration of the course in hours
lecturesCountIntNumber of lectures in the course
courseFeaturesCourseFeaturesAdditional course features
preOrderInfoCoursePreOrderInfoPre-order information if applicable
ratingRatingCourse rating information
faqSections[FaqSection!]FAQ sections for the course
plans[CurriculumPlan!]Available pricing plans for the course
usersUserPagePaginated list of users for this course

Users Field

The UserPage object includes user information through the user field. This returns a paginated list of users associated with the course.

  • UserPage object with:
    • nodes: Array of Course objects
    • currentPage: Current page number
    • hasNextPage: Whether there are more pages
    • hasPreviousPage: Whether there are previous pages
    • nodesCount: Total number of items in the current page
    • totalPages: Total number of pages

User Information in Users

Each subscription includes user information through the user field:

FieldTypeDescription
idString!User's unique identifier
nameStringUser's full name
emailStringUser's email address

Users Filter Parameters

ParameterTypeDescription
idStringOperatorFilter by user ID
emailStringOperatorFilter by user's email
nameStringOperatorFilter by user's name

Example with filtered users:

query {
  courses(
    page: 1
    perPage: 10
  ) {
    nodes {
      id
      name
      description
      slug
      featured

      users(
        filter: {
          email: { eq: "student@example.com" }
        }
      ) {
        nodes {
          id
          name
        }
      }
    }
    currentPage
    hasNextPage
    totalPages
  }
}

Detailed Query Structure

Below is a comprehensive view of fields available in the courses query based on the schema:

query {
  courses(
    filter: {
      id: { eq: "course-123" }
      tags: ["beginner"]
      featured: true
      state: { eq: "published" }
    }
    page: 1
    perPage: 20
  ) {
    nodes {
      id                          # Unique identifier (String!)
      name                        # Course name (String!)
      slug                        # URL-friendly identifier (String!)
      description                 # Course description (String)
      image                       # Course image URL (String)

      # Course settings
      featured                    # Whether the course is featured (Boolean!)
      invisible                   # Whether the course is hidden (Boolean!)
      publishedAt                 # When the course was published (Int)
      courseType                  # Type of course (String!)
      contentType                 # Content type (String!)
      template                    # Template style (String!)
      playerTheme                 # Player theme (String!)

      # Course content
      sections {                  # Course sections ([Section!]!)
        id
        title
        position
        duration
        lectures {                # Lectures within sections
          id
          title
          position
          duration
          isFreePreview
          isLocked
        }
      }

      # Categorization
      categories {                # Course categories ([Category!])
        id
        name
        slug
      }
      tags                        # Course tags ([String!])

      # Instructors
      lecturer {                  # Primary lecturer (Lecturer)
        id
        name
        avatar
        slug
      }
      lecturers {                 # All lecturers ([Lecturer!])
        id
        name
        avatar
        slug
      }

      # Assignments
      assignments {               # Course assignments ([Assignment!])
        id
        name
        description
        dueAt
      }

      # Course metrics
      totalHours                  # Total duration in hours (Float)
      lecturesCount               # Number of lectures (Int)

      # Additional information
      courseFeatures {            # Course features (CourseFeatures)
        studentsCount
        lecturesCount
        videoTotalHours
        audioTotalHours
        downloadableResourcesCount
        certificateOfCompletion
        lifetimeAccess
        moneyBackGuarantee
      }

      # Pre-order information
      preOrderInfo {              # Pre-order details (CoursePreOrderInfo)
        startedAt
        endedAt
        releasedAt
        buyersGoal
        buyersPledged
        moneyGoal
        moneyPledged
        goalType
        achievedPercentage
      }

      # Ratings
      rating {                    # Course rating (Rating)
        average
        total
      }

      # FAQ sections
      faqSections {               # FAQ sections ([FaqSection!])
        id
        name
        position
        faqContents {
          id
          title
          body
          position
          isPublished
        }
      }

      # Pricing plans
      plans {                     # Pricing plans ([CurriculumPlan!])
        id
        name
        description
        amount
        compareAtPrice
        currency
        currencySymbol
        planType
        position
        quantity
        interval
        intervalCount
        groupSize
        displayRemainingCount
        displaySoldCount
        remainingItemsCount
        soldItemsCount
        repeatPurchasable
        endedAt
        releaseAt
        coverPhoto
        createdAt
      }

      # Users                   # Users (UserPage)
      users (
        filter: {
          email: { eq: "student@example.com" }
        }
      ) {
        nodes {
          id
          name
          email
        }
      }
    }

    # Pagination information
    currentPage                   # Current page number (Int!)
    hasNextPage                   # Whether there are more pages (Boolean!)
    hasPreviousPage               # Whether there are previous pages (Boolean!)
    nodesCount                    # Number of items in current page (Int!)
    totalPages                    # Total number of pages (Int!)
  }
}

Plans Field

The plans field returns an array of CurriculumPlan objects representing the available pricing plans for the course. Each plan defines how students can access the course (free, one-time purchase, subscription, etc.).

CurriculumPlan Fields

FieldTypeDescription
idString!Unique identifier for the plan
nameStringDisplay name of the pricing plan
descriptionStringDetailed description of what's included
amountFloatPrice amount for the plan
compareAtPriceIntOriginal price before discount/sale
currencyString!ISO currency code (e.g., TWD, USD)
currencySymbolString!Currency symbol (e.g., $, €, £)
planTypeString!Plan type: free, one_time_purchase, subscription, pre_order, group_buy, fixed_date, specific_length, web3_discount
positionIntDisplay order position
quantityIntAvailable quantity for purchase
intervalStringBilling interval for subscription plans
intervalCountIntNumber of intervals between billing
groupSizeIntRequired group size for group_buy plans
displayRemainingCountBooleanWhether to show remaining quantity
displaySoldCountBooleanWhether to show sold count
remainingItemsCountIntNumber of items remaining
soldItemsCountIntNumber of items sold
repeatPurchasableBoolean!Whether plan can be purchased multiple times
endedAtIntUnix timestamp when plan expires
releaseAtIntUnix timestamp when plan becomes available
coverPhotoStringPlan cover image URL
createdAtInt!Unix timestamp when plan was created

Example with plans:

query {
  courses {
    nodes {
      id
      name
      plans {
        id
        name
        description
        amount
        currencySymbol
        planType
        remainingItemsCount
        soldItemsCount
      }
    }
  }
}

Filtering

The courses query accepts a filter parameter of type CourseFilter. This allows you to narrow down results based on various criteria.

Available Filters

Filter FieldTypeDescription
idStringOperatorFilter by course ID
tags[String!]Filter by course tags
categoryIds[String!]Filter by category IDs
categorySlugs[String!]Filter by category slugs
featuredBooleanFilter for featured courses
stateStringOperatorFilter by course state (unpublished, published)
preOrderStateStringFilter by pre-order state (upcoming, started, to_be_released, released)
hasAssignmentsBooleanFilter for courses with published assignments

StringOperator

The StringOperator used in filters has these operations:

OperationDescription
eqEqual to
neqNot equal to
inIn a list of values
ninNot in a list of values
likeMatch text values against a pattern using wildcards (case-sensitive)

Filter Examples

Find courses with specific tags:

query {
  courses(
    filter: {
      tags: ["beginner", "programming"]
    }
  ) {
    nodes {
      id
      name
      tags
    }
  }
}

Find featured courses in specific categories:

query {
  courses(
    filter: {
      featured: true,
      categorySlugs: ["programming", "web-development"]
    }
  ) {
    nodes {
      id
      name
      featured
      categories {
        name
        slug
      }
    }
  }
}

Find courses by ID:

query {
  courses(
    filter: {
      id: { eq: "course-123" }
    }
  ) {
    nodes {
      id
      name
    }
  }
}

Find courses by state:

query {
  courses(
    filter: {
      state: { eq: "published" }
    }
  ) {
    nodes {
      id
      name
      publishedAt
    }
  }
}

Find courses with multiple states:

query {
  courses(
    filter: {
      state: { in: ["published", "unpublished"] }
    }
  ) {
    nodes {
      id
      name
      publishedAt
    }
  }
}

On this page