Skip to main content

Update Batch API

This API is used to update batch details in LMS.

Request URL: (Blended Learning Course)

https://people.zoho.com/api/v1/courses/<courseId>/batches/<batchId>?batchData={"name" : <batchName>, "startDate" : <startDate>, "endDate" : <endDate>, "locations" : <locations>, "minimumCapacity" : <minimumCapacity>, "maximumCapacity":<maximumCapacity>, "allowWaitlisting" : <allowWaitlisting>,  "cancelBatchWhenMinimumCapacityIsNotMet" : <cancelBatchWhenMinimumCapacityIsNotMet>, "waitingTimeForCancellation" : <waitingTimeForCancellation>, "waitingTimeUnitForCancellation" : <waitingTimeUnitForCancellation>}

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

ParametersValues AllowedDefault ValueDescription
*batchData <parameters in JSON Object> JSON Input

 

ParametersValues AllowedDefault ValueDescription
name<Batch name><Mandatory>Specify the batch name
startDate<startDate date in DD-MM-YYYY format><Mandatory>Specify the start date
endDate<endDate date in DD-MM-YYYY format><Mandatory>Specify the end date
minimumCapacityinteger values<Mandatory>Specify the minimum capacity
maximumCapacityinteger values<Mandatory>Specify the maximum capacity
locationsArray of location ids-Specify the location ids
allowWaitlistingtrue|false-Specify if wait-listing should be allowed or not
cancelBatchWhenMinimumCapacityIsNotMettrue|false--
waitingTimeForCancellationinteger values-Specify waiting time to cancel batch
waitingTimeUnitForCancellation"day"- 

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

Copiedimport okhttp3.*;

public class Main {
    public static void main(String[] args) throws Exception {
        OkHttpClient client = new OkHttpClient();

        Request request = new Request.Builder()
            .url("https://people.zoho.com/api/v1/courses/478346000019439015/batches/478346000019439027?batchData=%7B%22name%22%20%3A%20%22Add%20Batch%20API%20Testing%201%22%2C%20%22startDate%22%20%3A%20%2229-12-2021%22%2C%20%22endDate%22%20%3A%20%2229-12-2021%22%2C%20%22locations%22%20%3A%20%5B%5D%2C%20%22minimumCapacity%22%20%3A%202%2C%20%22maximumCapacity%22%3A20%2C%20%22allowWaitlisting%22%20%3A%20true%2C%20%22cancelBatchWhenMinimumCapacityIsNotMet%22%20%3A%20true%2C%20%22waitingTimeForCancellation%22%20%3A%205%2C%20%22waitingTimeUnitForCancellation%22%20%3A%20%22day%22%7D")
            .patch(RequestBody.create(null, new byte[0]))
            .addHeader("Authorization", "Zoho-oauthtoken YOUR_ACCESS_TOKEN")
            .build();

        Response response = client.newCall(request).execute();
        System.out.println(response.body().string());
    }
}
Copiedfetch("https://people.zoho.com/api/v1/courses/478346000019439015/batches/478346000019439027?batchData=%7B%22name%22%20%3A%20%22Add%20Batch%20API%20Testing%201%22%2C%20%22startDate%22%20%3A%20%2229-12-2021%22%2C%20%22endDate%22%20%3A%20%2229-12-2021%22%2C%20%22locations%22%20%3A%20%5B%5D%2C%20%22minimumCapacity%22%20%3A%202%2C%20%22maximumCapacity%22%3A20%2C%20%22allowWaitlisting%22%20%3A%20true%2C%20%22cancelBatchWhenMinimumCapacityIsNotMet%22%20%3A%20true%2C%20%22waitingTimeForCancellation%22%20%3A%205%2C%20%22waitingTimeUnitForCancellation%22%20%3A%20%22day%22%7D", {
    method: "PATCH",
    headers: {
        "Authorization": "Zoho-oauthtoken YOUR_ACCESS_TOKEN"
    }
})
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.error(error));
Copiedcurl --location --request PATCH 'https://people.zoho.com/api/v1/courses/478346000019439015/batches/478346000019439027?batchData=%7B%22name%22%20%3A%20%22Add%20Batch%20API%20Testing%201%22%2C%20%22startDate%22%20%3A%20%2229-12-2021%22%2C%20%22endDate%22%20%3A%20%2229-12-2021%22%2C%20%22locations%22%20%3A%20%5B%5D%2C%20%22minimumCapacity%22%20%3A%202%2C%20%22maximumCapacity%22%3A20%2C%20%22allowWaitlisting%22%20%3A%20true%2C%20%22cancelBatchWhenMinimumCapacityIsNotMet%22%20%3A%20true%2C%20%22waitingTimeForCancellation%22%20%3A%205%2C%20%22waitingTimeUnitForCancellation%22%20%3A%20%22day%22%7D' \
--header 'Authorization: Zoho-oauthtoken YOUR_ACCESS_TOKEN'
Copiedurl = "https://people.zoho.com/api/v1/courses/478346000019439015/batches/478346000019439027?batchData=%7B%22name%22%20%3A%20%22Add%20Batch%20API%20Testing%201%22%2C%20%22startDate%22%20%3A%20%2229-12-2021%22%2C%20%22endDate%22%20%3A%20%2229-12-2021%22%2C%20%22locations%22%20%3A%20%5B%5D%2C%20%22minimumCapacity%22%20%3A%202%2C%20%22maximumCapacity%22%3A20%2C%20%22allowWaitlisting%22%20%3A%20true%2C%20%22cancelBatchWhenMinimumCapacityIsNotMet%22%20%3A%20true%2C%20%22waitingTimeForCancellation%22%20%3A%205%2C%20%22waitingTimeUnitForCancellation%22%20%3A%20%22day%22%7D";

headers = map();
headers.put("Authorization", "Zoho-oauthtoken YOUR_ACCESS_TOKEN");

response = invokeurl
[
    url : url
    type : PATCH
    headers: headers
];

info response;
Copiedimport requests

url = "https://people.zoho.com/api/v1/courses/478346000019439015/batches/478346000019439027?batchData=%7B%22name%22%20%3A%20%22Add%20Batch%20API%20Testing%201%22%2C%20%22startDate%22%20%3A%20%2229-12-2021%22%2C%20%22endDate%22%20%3A%20%2229-12-2021%22%2C%20%22locations%22%20%3A%20%5B%5D%2C%20%22minimumCapacity%22%20%3A%202%2C%20%22maximumCapacity%22%3A20%2C%20%22allowWaitlisting%22%20%3A%20true%2C%20%22cancelBatchWhenMinimumCapacityIsNotMet%22%20%3A%20true%2C%20%22waitingTimeForCancellation%22%20%3A%205%2C%20%22waitingTimeUnitForCancellation%22%20%3A%20%22day%22%7D"

headers = {
    "Authorization": "Zoho-oauthtoken YOUR_ACCESS_TOKEN"
}

response = requests.patch(url, headers=headers)

print(response.text)

Header

CopiedAuthorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxx9be93.9b8xxxxxxf

Response

Copied{
    "code": "200",
    "batch": {
        "startDateAsDisplayString": "25-12-2021",
        "endDateAsDisplayString": "01-02-2022",
        "cancelBatchWhenMinimumCapacityIsNotMet": true,
        "waitingTimeUnitForCancellation": "day",
        "batchId": "219225000000653025",
        "waitingTimeForCancellation": 10,
        "learnersCount": 0,
        "name": "Batch One_update",
        "minimumCapacity": 2,
        "locations": [],
        "maximumCapacity": 20,
        "courseId": "219225000000645203",
        "publishStatus": "unpublished"
    },
    "message": "success"
}