The createCourse
mutation allows you to create a new course in your school with the specified properties.
Field | Type | Description |
---|
input | AdminCourseInput! | Input object containing course creation details |
Field | Type | Required | Description |
---|
name | String! | Yes | Course name |
slug | String! | Yes | URL slug for the course. Must contain only lowercase letters, numbers, and hyphens |
courseType | String! | Yes | Type of the course (paid, public_access, free_redeem, pre_order) |
description | String | No | Course description |
categoryIds | [String!] | No | IDs of categories to associate with this course |
tagList | [String!] | No | Tags to associate with this course |
Return Type
type AdminCourseCreatePayload {
# The created course object, null if operation failed
# Array of error messages, if any occurred during the operation
Example
name: "GraphQL Fundamentals"
slug: "graphql-fundamentals"
description: "Learn the basics of GraphQL API development"
tagList: ["graphql", "api", "development"]
Sample Response
"name": "GraphQL Fundamentals",
"slug": "graphql-fundamentals",
"description": "Learn the basics of GraphQL API development"
Common Errors
Error | Description |
---|
Name cannot be empty | The course name is required |
Slug already exists | The provided slug is already in use |
Invalid course type | The courseType must be one of: paid, public_access, free_redeem, pre_order |
Category not found | One or more category IDs do not exist |
For more information about the Teachify Admin API, please refer to the API Overview.