Skip to product menu
Skip to main content

Update Session API

This API is used to update session in modules of a batch in LMS

Request URL: (Blended Learning Course)

https://people.zoho.com/api/v1/courses/<courseId>/batches/<batchId>/modules<moduleId>/sessions/<sessionId>?sessionData={"name" : <name> , "trainerErecno" : <trainerErecno>, "type" : <type> , "date" : <date>, "startTime" : <startTime>, "endTime" : <endTime>,"description" : <description>, "roomId": <roomId> , "lockUntil" : <lockUntil>, "gradeCategoryId" : <gradeCategoryId>}

Scope:

ZOHOPEOPLE.training.ALL
OR
ZOHOPEOPLE.training.UPDATE

Possible Operation Types:

ALL - Complete access to data
UPDATE - Only to edit data

Method:

PATCH

Request Parameters

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

 

ParametersValues AllowedDefault ValueDescription
name<File name><Mandatory>Specify the file name
trainerErecno<Trainer erecno><Mandatory>Specify the trainer erecno
type<0|1><Mandatory>Specify the session type 
0 -> Classroom
1-> E-learning
datedate in DD_MM_YYYY format<Mandatory>Specify the session date
startTimeTime in 12 Hour clock format<Mandatory>Specify the session start time
endTimeTime in 12 Hour clock format<Mandatory>Specify the session end time
description<Description>-Specify the description
roomId<Room >-Specify the room id
resources<lockUntil date in DD-MM-YYYY format>-Specify the lockUntil date
gradeCategoryId<Grade category id>-Specify the Grade category id

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 (Update Session)

Copiedimport okhttp3.*;

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

        String url = "https://people.zoho.com/api/v1/courses/478346000019479103/batches/478346000019479115/modules/478346000019479119/sessions/478346000019553023";

        String jsonPayload = "{"
                + "\"name\":\"Session API Testing\","
                + "\"trainerErecno\":\"478346000008251001\","
                + "\"type\":\"0\","
                + "\"date\":\"04-01-2022\","
                + "\"startTime\":\"10:00 AM\","
                + "\"endTime\":\"11:00 AM\","
                + "\"description\":\"API testing\","
                + "\"roomId\":\"478346000010125093\","
                + "\"gradeCategoryId\":\"478346000019553021\""
                + "}";

        RequestBody body = RequestBody.create(
                jsonPayload, MediaType.get("application/json"));

        Request request = new Request.Builder()
                .url(url)
                .patch(body)
                .addHeader("Authorization", "Zoho-oauthtoken YOUR_ACCESS_TOKEN")
                .addHeader("Content-Type", "application/json")
                .build();

        Response response = client.newCall(request).execute();
        System.out.println(response.body().string());
    }
}
Copiedconst url = "https://people.zoho.com/api/v1/courses/478346000019479103/batches/478346000019479115/modules/478346000019479119/sessions/478346000019553023";

const data = {
    name: "Session API Testing",
    trainerErecno: "478346000008251001",
    type: "0",
    date: "04-01-2022",
    startTime: "10:00 AM",
    endTime: "11:00 AM",
    description: "API testing",
    roomId: "478346000010125093",
    gradeCategoryId: "478346000019553021"
};

fetch(url, {
    method: "PATCH",
    headers: {
        "Authorization": "Zoho-oauthtoken YOUR_ACCESS_TOKEN",
        "Content-Type": "application/json"
    },
    body: JSON.stringify(data)
})
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.error("Error:", error));
Copiedcurl -X PATCH "https://people.zoho.com/api/v1/courses/478346000019479103/batches/478346000019479115/modules/478346000019479119/sessions/478346000019553023" \
-H "Authorization: Zoho-oauthtoken YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
  "name": "Session API Testing",
  "trainerErecno": "478346000008251001",
  "type": "0",
  "date": "04-01-2022",
  "startTime": "10:00 AM",
  "endTime": "11:00 AM",
  "description": "API testing",
  "roomId": "478346000010125093",
  "gradeCategoryId": "478346000019553021"
}'
Copiedurl = "https://people.zoho.com/api/v1/courses/478346000019479103/batches/478346000019479115/modules/478346000019479119/sessions/478346000019553023";

headers = map();
headers.put("Authorization", "Zoho-oauthtoken YOUR_ACCESS_TOKEN");
headers.put("Content-Type", "application/json");

data = map();
data.put("name", "Session API Testing");
data.put("trainerErecno", "478346000008251001");
data.put("type", "0");
data.put("date", "04-01-2022");
data.put("startTime", "10:00 AM");
data.put("endTime", "11:00 AM");
data.put("description", "API testing");
data.put("roomId", "478346000010125093");
data.put("gradeCategoryId", "478346000019553021");

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

info response;
Copiedimport requests

url = "https://people.zoho.com/api/v1/courses/478346000019479103/batches/478346000019479115/modules/478346000019479119/sessions/478346000019553023"

payload = {
    "name": "Session API Testing",
    "trainerErecno": "478346000008251001",
    "type": "0",
    "date": "04-01-2022",
    "startTime": "10:00 AM",
    "endTime": "11:00 AM",
    "description": "API testing",
    "roomId": "478346000010125093",
    "gradeCategoryId": "478346000019553021"
}

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

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

print(response.text)

Show full

Show less

Header

CopiedAuthorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxx9be93.9b8xxxxxxf

Response

Copied{
    "code": 200,
    "session": {
        "totalLearnersCount": 0,
        "sessionName": "Session One_Update",
        "sessionEndTime": "11:00 AM",
        "sessionStartTime": "10:00 AM",
        "description": "Description for Session",
        "resources": [],
        "sessionId": "219225000000648145",
        "roomId": "219225000000645249",
        "canUserDelete": false,
        "sessionStartDate": "30-12-2021",
        "lockUntil": "28-12-2021",
        "presentLeanersCount": 0,
        "gradeCategoryName": "",
        "isLocked": true,
        "gradeCategoryId": "",
        "sessionType": "Classroom",
        "sessionRoom": "Room  One",
        "sessionTrainer": "Henry",
        "isSessionCompleted": false,
        "trainerErecno": "219225000000036453",
        "canUserEdit": false,
        "moduleId": "219225000000645219"
    },
    "message": "success"
}

Show full

Show less