Set Batch Schedule
Sets the weekly timetable for the classes (subjects) of a batch and generates their sessions between the start and end dates. Put the batch's `master_batch_id` in the URL. Each class's existing weekly timetable is replaced.
/masterbatch/{master_batch_id}/schedulecurl --request POST \
--url 'https://<your-api-host>/nuSource/api/v1/masterbatch/{master_batch_id}/schedule' \
--header 'APIKEY: <your-api-key>' \
--header 'ORGID: <your-org-id>' \
--form 'JSONString={"class_array":[{"class_id":2372,"tutor_id":"27","timings":[{"day":1,"s_hour":9,"s_minute":0,"e_hour":10,"e_minute":0,"isSelected":true,"tutor_id":"1"},{"day":2,"s_hour":9,"s_minute":0,"e_hour":10,"e_minute":0,"isSelected":true,"tutor_id":"1"},{"day":3,"s_hour":9,"s_minute":0,"e_hour":10,"e_minute":0,"isSelected":true,"tutor_id":"1"},{"day":4,"s_hour":9,"s_minute":0,"e_hour":10,"e_minute":0,"isSelected":true,"tutor_id":"1"}]}],"s_start_date":"01 Jul 2022","s_end_date":"31 Jul 2022","replace_schedule":0,"batch_class_count":0}'{
"code": 200,
"message": "Success"
}Access: Institute admins and tutors.
Request body: form-data with one field, JSONString, containing this JSON:
JSONStringD Mon YYYY (for example 1 Jul 2022). Must not be before the batch start date.1 saves the timetable even when enrolled students have clashing sessions. Default 0.1 allows slots that end after midnight. Without it, such a slot fails with code 5021.Fields in each class_array object:
| Name | Required | Type | Description |
|---|---|---|---|
| class_id | Yes | integer | A class in this batch (see "Get Batch Schedule"). Other IDs fail with "Invalid class id." |
| timings | Yes | array | Weekly slots, each with day (0 Sunday to 6 Saturday), s_hour, s_minute, e_hour, e_minute, and optionally tutor_id. |
| tutor_id | No | integer | Tutor for the generated sessions. Defaults to the class's tutor. |
| batch_class_count | No | integer | If above 0, the class is scheduled by number of sessions instead: the given count of sessions is created and the batch's start and end dates are updated to match. |
Notes: Overlapping slots for the same class on the same day fail with code 5012 "Duplicate Schedule". If enrolled students have clashing sessions and force_update is not 1, the request fails with code 5011 and lists the clashes. Dates outside the batch dates fail with "Schedule start and end cannot be outside master batch start and end dates." Rate limit: 100 requests per minute; going over locks you out for 30 minutes.