Create Batch Scheduler API
This API is used to create a new batch scheduler in LMS.
Request URL:
https://people.zoho.com/api/v1/courses/<courseId>/batches/schedulers?batchSchedulerData ={"batchName" : <batchName>, "batchNameSuffixSeparator" : <batchNameSuffixSeparator>, "batchNameSuffix" : <batchNameSuffix>, "startDate" : <startDate>, "endDate" : <endDate>, "locations" : <locations>, "minimumCapacity" : <minimumCapacity>, "maximumCapacity" : <maximumCapacity>, "frequency" : <frequency>, "frequencyUnit" : <frequencyUnit>, "offset" : <offset>, "offsetUnit" :<offsetUnit>, "daysOfTheWeek" : <daysOfTheWeek>, "datesOfTheMonth" : <datesOfTheMonth>, "weeksOfTheMonth" : <weeksOfTheMonth>, "monthsOfTheYear" : <monthsOfTheYear>, "allowWaitlisting" : <allowWaitlisting>, "cancelBatchWhenMinimumCapacityIsNotMet" : <cancelBatchWhenMinimumCapacityIsNotMet>,"waitingTimeForCancellation" : <waitingTimeForCancellation>,"waitingTimeUnitForCancellation" : <waitingTimeUnitForCancellation>, "cloneType" : <cloneType>, "sourceBatchId" : <sourceBatchId>, "notifyApplicableUsers" : <notifyApplicableUsers>, "publishBatchAutomatically" : <publishBatchAutomatically>, "notifyClonedMembers" : <notifyClonedMembers>}
Scope:
ZOHOPEOPLE.training.ALL
OR
ZOHOPEOPLE.training.CREATE
Possible Operation Types:
ALL - Complete access to data
CREATE - Only to add data
Method:
POST
Request Parameters
Parameters | Values Allowed | Default Value | Description |
*batchShedulerData | <parameters in JSON Object> | JSON Input |
Parameters | Values Allowed | Default Value | Description |
*batchName | <Batch name> | <Mandatory> | Specify the batch name |
*startDate | <lockUntil date in DD-MM-YYYY format> | <Mandatory> | Specify the start date |
*endDate | <lockUntil date in DD-MM-YYYY format> | <Mandatory> | Specify the end date |
*frequency | integer values | <Mandatory> | Specify the frequency |
*frequencyUnit | week|month|year | <Mandatory> | Specify the frequency unit |
batchNameSuffixSeparator | _|- | - | Specify the batch name suffix separator |
batchNameSuffix | number|dd/MM/yyyy|dd/MM | Specify the batch name suffix | |
minimumCapacity | integer values | <Mandatory> | Specify the minimum capacity |
maximumCapacity | integer values | <Mandatory> | Specify the maximum capacity |
locations | Array of location ids | - | Specify the location ids |
offset | -(1|7|14|30) | - | |
offsetUnit | "day" | - | |
daysOfTheWeek | 1-7 | - | Specify the days of the week from 1- 7 which represents sunday to saturday |
datesOfTheMonth | 1-31 | - | Specify the days of the month |
weeksOfTheMonth | 1-5 | Specify the week of the month which represents the first to fifth week | |
monthsOfTheYear | 1-12 | - | Specify the month of the year which represents January to December |
allowWaitlisting | true|false | - | Specify if wait-listing should be allowed or not |
cancelBatchWhenMinimumCapacityIsNotMet | true|false | - | - |
waitingtTimeForCancellation | integer values | - | Specify waiting time to cancel batch |
waitingtTimeUnitForCancellation | day | - | Specify the value for waiting time unit for cancellation |
cloneType | 0|1|2 | Specify the clone type | |
sourceBatchId | long | - | Specify the source batch id |
notifyApplicableuUsers | true|false | - | Specify the notify applicable users |
publishBatchAutomatically | true|false | - | Specify the publish batch automatically |
notifyClonedMembers | true|false | - | Specify the notify cloned members |
*mandatory parameters
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) throws Exception {
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "batchSchedulerData=%7B%22batchName%22%20%3A%20%22API%20Testing%20%20Batch%20Scheduler%22%2C%20%22batchNameSuffixSeparator%22%20%3A%20%22-%22%2C%20%22batchNameSuffix%22%20%3A%20%22number%22%2C%20%22startDate%22%20%3A%2204-04-2021%22%2C%20%22endDate%22%20%3A%20%2224-06-2021%22%2C%22locations%22%20%3A%20%5B%5D%2C%20%22minimumCapacity%22%20%3A%201%2C%20%22maximumCapacity%22%20%3A%20100%2C%20%22frequency%22%20%3A%201%2C%22frequencyUnit%22%20%3A%20%22week%22%2C%20%22offset%22%20%3A%20-1%2C%20%22offsetUnit%22%20%3A%20%22day%22%2C%20%22daysOfTheWeek%22%20%3A%20%5B2%2C6%5D%2C%22datesOfTheMonth%22%20%3A%20%5B%5D%2C%20%22weeksOfTheMonth%22%20%3A%20%5B%5D%2C%20%22monthsOfTheYear%22%20%3A%20%5B%5D%2C%20%22allowWaitlisting%22%20%3A%20true%2C%20%22cancelBatchWhenMinimumCapacityIsNotMet%22%20%3A%20true%2C%22waitingTimeForCancellation%22%3A%203%2C%22waitingTimeUnitForCancellation%22%20%3A%20%22day%22%2C%20%22cloneType%22%20%3A%200%2C%20%22sourceBatchId%22%20%3A%20588882000001019001%2C%20%22notifyApplicableUsers%22%20%3A%20true%2C%22publishBatchAutomatically%22%20%3Afalse%2C%20%22notifyClonedMembers%22%20%3A%20false%7D");
Request request = new Request.Builder()
.url("https://people.zoho.com/api/v1/courses/588882000001018001/batches/schedulers")
.post(body)
.addHeader("Content-Type", "application/x-www-form-urlencoded")
.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/588882000001018001/batches/schedulers", {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Zoho-oauthtoken YOUR_ACCESS_TOKEN"
},
body: "batchSchedulerData=%7B%22batchName%22%20%3A%20%22API%20Testing%20%20Batch%20Scheduler%22%2C%20%22batchNameSuffixSeparator%22%20%3A%20%22-%22%2C%20%22batchNameSuffix%22%20%3A%20%22number%22%2C%20%22startDate%22%20%3A%2204-04-2021%22%2C%20%22endDate%22%20%3A%20%2224-06-2021%22%2C%22locations%22%20%3A%20%5B%5D%2C%20%22minimumCapacity%22%20%3A%201%2C%20%22maximumCapacity%22%20%3A%20100%2C%20%22frequency%22%20%3A%201%2C%22frequencyUnit%22%20%3A%20%22week%22%2C%20%22offset%22%20%3A%20-1%2C%20%22offsetUnit%22%20%3A%20%22day%22%2C%20%22daysOfTheWeek%22%20%3A%20%5B2%2C6%5D%2C%22datesOfTheMonth%22%20%3A%20%5B%5D%2C%20%22weeksOfTheMonth%22%20%3A%20%5B%5D%2C%20%22monthsOfTheYear%22%20%3A%20%5B%5D%2C%20%22allowWaitlisting%22%20%3A%20true%2C%20%22cancelBatchWhenMinimumCapacityIsNotMet%22%20%3A%20true%2C%22waitingTimeForCancellation%22%3A%203%2C%22waitingTimeUnitForCancellation%22%20%3A%20%22day%22%2C%20%22cloneType%22%20%3A%200%2C%20%22sourceBatchId%22%20%3A%20588882000001019001%2C%20%22notifyApplicableUsers%22%20%3A%20true%2C%22publishBatchAutomatically%22%20%3Afalse%2C%20%22notifyClonedMembers%22%20%3A%20false%7D"
})
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.error(error));
Copiedcurl --location --request POST 'https://people.zoho.com/api/v1/courses/588882000001018001/batches/schedulers' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Zoho-oauthtoken YOUR_ACCESS_TOKEN' \
--data-raw 'batchSchedulerData=%7B%22batchName%22%20%3A%20%22API%20Testing%20%20Batch%20Scheduler%22%2C%20%22batchNameSuffixSeparator%22%20%3A%20%22-%22%2C%20%22batchNameSuffix%22%20%3A%20%22number%22%2C%20%22startDate%22%20%3A%2204-04-2021%22%2C%20%22endDate%22%20%3A%20%2224-06-2021%22%2C%22locations%22%20%3A%20%5B%5D%2C%20%22minimumCapacity%22%20%3A%201%2C%20%22maximumCapacity%22%20%3A%20100%2C%20%22frequency%22%20%3A%201%2C%22frequencyUnit%22%20%3A%20%22week%22%2C%20%22offset%22%20%3A%20-1%2C%20%22offsetUnit%22%20%3A%20%22day%22%2C%20%22daysOfTheWeek%22%20%3A%20%5B2%2C6%5D%2C%22datesOfTheMonth%22%20%3A%20%5B%5D%2C%20%22weeksOfTheMonth%22%20%3A%20%5B%5D%2C%20%22monthsOfTheYear%22%20%3A%20%5B%5D%2C%20%22allowWaitlisting%22%20%3A%20true%2C%20%22cancelBatchWhenMinimumCapacityIsNotMet%22%20%3A%20true%2C%22waitingTimeForCancellation%22%3A%203%2C%22waitingTimeUnitForCancellation%22%20%3A%20%22day%22%2C%20%22cloneType%22%20%3A%200%2C%20%22sourceBatchId%22%20%3A%20588882000001019001%2C%20%22notifyApplicableUsers%22%20%3A%20true%2C%22publishBatchAutomatically%22%20%3Afalse%2C%20%22notifyClonedMembers%22%20%3A%20false%7D'
Copiedurl="https://people.zoho.com/api/v1/courses/588882000001018001/batches/schedulers";
headers = map();
headers.put("Content-Type", "application/x-www-form-urlencoded");
headers.put("Authorization", "Zoho-oauthtoken YOUR_ACCESS_TOKEN");
payload = "batchSchedulerData=%7B%22batchName%22%20%3A%20%22API%20Testing%20Batch%20Scheduler%22%2C%20%22batchNameSuffixSeparator%22%20%3A%20%22-%22%2C%20%22batchNameSuffix%22%20%3A%20%22number%22%2C%20%22startDate%22%20%3A%2204-04-2021%22%2C%20%22endDate%22%20%3A%20%2224-06-2021%22%2C%22locations%22%20%3A%20%5B%5D%2C%20%22minimumCapacity%22%20%3A%201%2C%20%22maximumCapacity%22%20%3A%20100%2C%20%22frequency%22%20%3A%201%2C%22frequencyUnit%22%20%3A%20%22week%22%2C%20%22offset%22%20%3A%20-1%2C%20%22offsetUnit%22%20%3A%20%22day%22%2C%20%22daysOfTheWeek%22%20%3A%20%5B2%2C6%5D%2C%22datesOfTheMonth%22%20%3A%20%5B%5D%2C%20%22weeksOfTheMonth%22%20%3A%20%5B%5D%2C%20%22monthsOfTheYear%22%20%3A%20%5B%5D%2C%20%22allowWaitlisting%22%20%3A%20true%2C%20%22cancelBatchWhenMinimumCapacityIsNotMet%22%20%3A%20true%2C%22waitingTimeForCancellation%22%3A%203%2C%22waitingTimeUnitForCancellation%22%20%3A%20%22day%22%2C%20%22cloneType%22%20%3A%200%2C%20%22sourceBatchId%22%20%3A%20588882000001019001%2C%20%22notifyApplicableUsers%22%20%3A%20true%2C%22publishBatchAutomatically%22%20%3Afalse%2C%20%22notifyClonedMembers%22%20%3A%20false%7D";
response = invokeurl
[
url : url
type : POST
parameters: payload
headers: headers
];
info response;
Copiedimport requests
url = "https://people.zoho.com/api/v1/courses/588882000001018001/batches/schedulers"
headers = {
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Zoho-oauthtoken YOUR_ACCESS_TOKEN"
}
payload = "batchSchedulerData=..."
response = requests.post(url, headers=headers, data=payload)
print(response.text)
Header
CopiedAuthorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxx9be93.9b8xxxxxxf
Response
Copied{
"batchScheduler": {
"batchName": "Batch Scheduler One",
"frequencyUnit": "week",
"cloneType": 0,
"schedulerId": "219225000000658013",
"publishBatchAutomatically": false,
"batchNameSuffixSeparator": 0,
"waitingTimeUnitForCancellation": "day",
"sourceBatch": null,
"frequency": 1,
"offsetUnit": "day",
"minimumCapacity": 1,
"maximumCapacity": 100,
"notifyClonedMembers": false,
"notifyApplicableUsers": false,
"courseId": "219225000000645203",
"monthsOfTheYear": [],
"batchNameSuffix": "number",
"daysOfTheMonth": [],
"startDateAsDisplayString": "28-12-2021",
"offset": -1,
"endDateAsDisplayString": "28-02-2022",
"cancelBatchWhenMinimumCapacityIsNotMet": true,
"waitingTimeForCancellation": 3,
"allowWaitlisting": true,
"daysOfTheWeek": [
"2",
"6"
],
"totalNumberOfBatchesCreated": 0,
"weeksOfTheMonth": [],
"locations": []
},
"code": "200",
"message": "success"
}