Update Course API
This API is used for updating courses in LMS.
Request URL:
https://people.zoho.com/api/v1/courses/<courseId>?courseData={"[name"](https://people.zoho.com/api/v1/courses?courseData={%22name%22) : <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.UPDATE
Possible Operation Types:
ALL - Complete access to data
UPDATE - Only to update data
Method:
PATCH
Request Parameters:
Parameters | Values Allowed | Default Value | Description |
*courseData | <parameters in JSON Object> | JSON Input |
Parameters | Values Allowed | Default Value | Description |
*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:
Value | Description |
---|---|
admin | Admin user |
courseAdmin | Course administrator |
manager | Manager of the learner |
learner | The learner themselves |
whenAnEntityIsConsideredAsCompleted:
Value | Description |
---|---|
1 | When an entity is marked as completed by the learner |
2 | When an entity is opened or accessed |
whenACourseIsConsideredAsCompleted:
Value | Description |
---|---|
1 | When the learner marks as completed |
2 | When all mandatory entities are completed |
3 | When course admin/trainer marks as complete |
4 | Based on date |
whenAModuleIsConsideredAsCompleted:
Value | Description |
---|---|
1 | When the learner marks as completed |
2 | When all mandatory entities are completed |
Error Codes and Descriptions
Status Codes | Description |
---|---|
400 | Invalid parameter value/input parameter missing |
403 | Sorry! You are not authorized to do this operation |
404 | Not found |
422 | Maximum limit exceeded |
500 | Sorry! 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
Copiedimport okhttp3.*;
public class Main {
public static void main(String[] args) {
OkHttpClient client = new OkHttpClient();
String json = "{"
+ "\"name\": \"Updated Course Name\","
+ "\"type\": 1,"
+ "\"description\": \"Updated description\","
+ "\"aboutCourse\": \"Updated about the API\","
+ "\"duration\": 30,"
+ "\"durationUnit\": \"minute\","
+ "\"courseCode\": \"XXX\","
+ "\"courseAdmins\": [123456, 789012],"
+ "\"categories\": [345678]"
+ "}";
RequestBody body = RequestBody.create(json, MediaType.parse("application/json"));
Request request = new Request.Builder()
.url("https://people.zoho.com/api/v1/courses/YOUR_COURSE_ID")
.patch(body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Zoho-oauthtoken YOUR_ACCESS_TOKEN")
.build();
try (Response response = client.newCall(request).execute()) {
System.out.println(response.body().string());
} catch (Exception e) {
e.printStackTrace();
}
}
}
Copiedconst url = "https://people.zoho.com/api/v1/courses/YOUR_COURSE_ID";
const headers = {
"Content-Type": "application/json",
"Authorization": "Zoho-oauthtoken YOUR_ACCESS_TOKEN"
};
const body = JSON.stringify({
name: "Updated Course Name",
type: 1,
description: "Updated description",
aboutCourse: "Updated about the API",
duration: 30,
durationUnit: "minute",
courseCode: "XXX",
courseAdmins: [123456, 789012],
categories: [345678]
});
fetch(url, {
method: "PATCH",
headers: headers,
body: body
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Error:", error));
Copiedcurl -X PATCH "https://people.zoho.com/api/v1/courses/YOUR_COURSE_ID" \
-H "Content-Type: application/json" \
-H "Authorization: Zoho-oauthtoken YOUR_ACCESS_TOKEN" \
-d '{
"name": "Updated Course Name",
"type": 1,
"description": "Updated description",
"aboutCourse": "Updated about the API",
"duration": 30,
"durationUnit": "minute",
"courseCode": "XXX",
"courseAdmins": [123456, 789012],
"categories": [345678]
}'
Copiedurl = "https://people.zoho.com/api/v1/courses/YOUR_COURSE_ID";
headers = map();
headers.put("Content-Type", "application/json");
headers.put("Authorization", "Zoho-oauthtoken YOUR_ACCESS_TOKEN");
body = map();
body.put("name", "Updated Course Name");
body.put("type", 1);
body.put("description", "Updated description");
body.put("aboutCourse", "Updated about the API");
body.put("duration", 30);
body.put("durationUnit", "minute");
body.put("courseCode", "XXX");
body.put("courseAdmins", list(123456, 789012));
body.put("categories", list(345678));
response = invokeurl
[
url : url
type : PATCH
parameters: body.toString()
headers: headers
];
info response;
Copiedimport requests
url = "https://people.zoho.com/api/v1/courses/YOUR_COURSE_ID"
payload = {
"name": "Updated Course Name",
"type": 1,
"description": "Updated description",
"aboutCourse": "Updated about the API",
"duration": 30,
"durationUnit": "minute",
"courseCode": "XXX",
"courseAdmins": [123456, 789012],
"categories": [345678]
}
headers = {
"Content-Type": "application/json",
"Authorization": "Zoho-oauthtoken YOUR_ACCESS_TOKEN"
}
response = requests.patch(url, headers=headers, json=payload)
print(response.json())
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