Skip to main content

Create Course API

This API is used for creating new courses in LMS.

Request URL:

https://people.zoho.com/api/v1/courses?courseData={"name" : <name>,  "type" : <type>, "description" : <description>, "aboutCourse" : <aboutCourse>, "duration" : <duration>, "durationUnit" : <durationUnit>, "courseCode" : <courseCode>,  "courseAdmins" : <courseAdmins>, "categories" : <categories>, "permissionSettings" : <permissionSettings>}

Scope:

ZOHOPEOPLE.training.ALL
OR
ZOHOPEOPLE.training.CREATE

Possible Operation Types:

ALL - Complete access to data
CREATE - Only to create data

Method:

POST

Request Parameters

ParametersValues AllowedDefault ValueDescription
*courseData <parameters in JSON Object> JSON Input
ParametersValues AllowedDefault ValueDescription
*name<Course name><Mandatory>Specify the Course name
*type<1> | <2> | <3><Mandatory>Specify the Course type 
1 - Self Paced
2 - Blended Learning
3 - E-Matrerial
description<Description>-Specify the description
aboutCourse<about course>-Specify what is covered in the course along with the details on the content of the course
duration<Duration in integer format>-Specify the course duration
durationUnit<minute> | <hour> | <day>-Specify the course code
courseCode<Course Code>-Specify the course code
courseAdmins<Erec Nos>-Specify the course admins
categories<category Ids>-Specify the category Ids
permissionSettings<permissionSettings>-JSON Input

References

Sample object for "permissionSettings" key {"whoCanEnroll" : ["admin","learner"], "whoCanUnenroll" : ["admin","learner"], 
"whenAnEntityIsConsideredAsCompleted" : 2, 
"whenACourseIsConsideredAsCompleted" : 2, 
"whenAModuleIsConsideredAsCompleted" : 2}

Possible Values

whoCanEnroll / whoCanUnenroll:

ValueDescription
adminAdmin user
courseAdminCourse administrator
managerManager of the learner
learnerThe learner themselves

whenAnEntityIsConsideredAsCompleted:

ValueDescription
1When an entity is marked as completed by the learner
2When an entity is opened or accessed

whenACourseIsConsideredAsCompleted:

ValueDescription
1When the learner marks as completed
2When all mandatory entities are completed
3When course admin/trainer marks as complete
4Based on date

whenAModuleIsConsideredAsCompleted:

ValueDescription
1When the learner marks as completed
2When all mandatory entities are completed

Error Codes and Descriptions

Status CodesDescription
400Invalid parameter value/input parameter missing
403Sorry! You are not authorized to do this operation
404Not found
422Maximum limit exceeded
500Sorry! Server error occured

View complete list of LMS API error codes

Threshold Limit: 30 requests | Lock period: 5 minutes

Threshold Limit - Number of API calls allowed within a minute.
Lock Period - Wait time before consecutive API requests.

Request

CopiedOkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "inputData={Single_Line_1:\"a1\",Multi_Line_1:\"12\",Lookup_1:\"705358000000229001\"}");
Request request = new Request.Builder()
  .url("https://people.zoho.com/api/forms/json/test_form/insertRecord")
  .method("POST", body)
  .addHeader("Content-Type", "application/x-www-form-urlencoded")
  .addHeader("Authorization", "••••••")
  .build();
Response response = client.newCall(request).execute();
Copiedconst url = "https://people.zoho.com/api/v1/courses";

const headers = {
    "Content-Type": "application/json",
    "Authorization": "Zoho-oauthtoken YOUR_ACCESS_TOKEN"
};

const body = JSON.stringify({
    name: "CourseCreatedByAPI",
    type: 1,
    description: "Description for the course",
    aboutCourse: "Course created by API",
    duration: 30,
    durationUnit: "minute",
    courseCode: "cadm",
    courseAdmins: [],
    categories: []
});

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Error:", error));
Copiedcurl -X POST "https://people.zoho.com/api/v1/courses" \
     -H "Content-Type: application/json" \
     -H "Authorization: Zoho-oauthtoken YOUR_ACCESS_TOKEN" \
     -d '{
           "name": "CourseCreatedByAPI",
           "type": 1,
           "description": "Description for the course",
           "aboutCourse": "Course created by API",
           "duration": 30,
           "durationUnit": "minute",
           "courseCode": "cadm",
           "courseAdmins": [],
           "categories": []
         }'
Copiedurl = "https://people.zoho.com/api/v1/courses";
headers = map();
headers.put("Content-Type", "application/json");
headers.put("Authorization", "Zoho-oauthtoken YOUR_ACCESS_TOKEN");

body = map();
body.put("name", "CourseCreatedByAPI");
body.put("type", 1);
body.put("description", "Description for the course");
body.put("aboutCourse", "Course created by API");
body.put("duration", 30);
body.put("durationUnit", "minute");
body.put("courseCode", "cadm");
body.put("courseAdmins", list());
body.put("categories", list());

response = invokeurl
[
    url : url
    type : POST
    parameters: body.toString()
    headers: headers
];

info response;
Copiedimport requests
import json

url = "https://people.zoho.com/api/v1/courses"

payload = {
    "name": "CourseCreatedByAPI",
    "type": 1,
    "description": "Description for the course",
    "aboutCourse": "Course created by API",
    "duration": 30,
    "durationUnit": "minute",
    "courseCode": "cadm",
    "courseAdmins": [],
    "categories": []
}

headers = {
    "Content-Type": "application/json",
    "Authorization": "Zoho-oauthtoken YOUR_ACCESS_TOKEN"
}

response = requests.post(url, headers=headers, data=json.dumps(payload))

print(response.text)

Show full

Show less

Header

CopiedAuthorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxx9be93.9b8xxxxxxf

Response

Copied{
    "code": "200",
    "course": {
        "canUserRequestToJoin": false,
        "canUserAddLearners": true,
        "durationAsDisplayString": "30 Minutes",
        "courseCode": "0001",
        "description": "Course to learn Java couse",
        "courseURL": "https://people.zoho.com/idcportalfb18/zp/lmscourse#lms-learner/course/588882000000984009/overview",
        "type": "1",
        "canUserGiveFeedback": true,
        "canUserShare": true,
        "canUserDelete": true,
        "permissionSettings": {
            "whenAModuleIsConsideredAsCompleted": "1",
            "whoCanEnroll": [
                "admin",
                "courseAdmin",
                "learner"
            ],
            "whenAnEntityIsConsideredAsCompleted": "1",
            "whenACourseIsConsideredAsCompleted": "2"
        },
        "hasUserCompleted": false,
        "canUserUnpublish": true,
        "canUserSuggest": false,
        "currentUserRole": {
            "settingsAdmin": false,
            "courseOwner": true,
            "trainer": false,
            "sharedUser": false,
            "learner": false,
            "admin": true,
            "courseAdmin": false,
            "dataAdmin": false
        },
        "canUserShareCourseURL": false,
        "isSuggestedCourse": false,
        "isDisabled": false,
        "categories": [],
        "isFavourite": false,
        "courseId": "588882000000984009",
        "aboutCourse": "You will be familiar with basic aspects of Java, including procedural programming and object-oriented programming",
        "publishStatus": "unpublished",
        "hasUserStarted": true,
        "introFiles": [],
        "canUserFavourite": true,
        "progressAsDisplayString": "0 of 0 Completed",
        "canUserDisable": false,
        "typeAsDisplayString": "Self paced learning",
        "isSharedCourse": false,
        "canUserDeleteLearners": true,
        "percentageOfProgress": 0,
        "courseOwners": [
            {
                "erecno": "588882000000162005",
                "displayName": "adam CEO logicx",
                "employeeId": "1",
                "emailId": "davisvenfield@zohotest.com",
                "displayPictureURL": "https://people.zoho.com/api/viewEmployeePhoto?filename=953310000000021001"
            }
        ],
        "canUserStartDiscussion": false,
        "canUserComplete": false,
        "statusAsDisplayString": "Drafted",
        "canUserUnEnroll": true,
        "canUserUnfavourite": true,
        "canUserRevokeCompletion": false,
        "courseImageURL": null,
        "canUserPublish": true,
        "name": "An Introduction to Java",
        "courseAdmins": [
{
                "erecno": "588882000000162005",
                "displayName": "adam CEO logicx",
                "employeeId": "1",
                "emailId": "davisvenfield@zohotest.com",
                "displayPictureURL": "https://people.zoho.com/api/viewEmployeePhoto?filename=953310000000021001"
            }
         ],
        "canUserEnroll": true,
        "canUserPreview": true,
        "status": 0
    },
    "message": "success"
}

Show full

Show less