β›³Creating and Updating Sessions

This page explains how you can both create, and update sessions in a single request.

In order to create and update sessions, the request needs to include a JSON array body that has the session objects. The objects can be of type CreateSession or UpdateSession.

The same endpoint handles both create and update operations for sessions. The operation type is determined by the presence of the session_guid parameter in the request body. Including session_guid indicates an update operation, while omitting it indicates a create operation.


Example Request:

curl -L -X POST 'https:https://<DOMAIN>/xapi/v2/session/batch' \
-H 'Content-Type: application/json' \
-d '[
    // Insert session
    {
        "name": "CS201",
        "description": "Let's learn the fundemental technologies used in Web Development",
        "start_date": "2025-08-05T12:00:00Z",
        "duration": 120,
        "lang": "en-US"
    },
    // Insert session with an incorrect start_date
    {
        "name": "TR102",
        "start_date": "2020-08-05T14:00:00Z",
        "duration": 120,
        "lang": "tr-TR",
        "options": {
            "allow_rating": false
        }
    },
    // Update session
    {
        "session_guid": "61E3D504-13EE-447F-9B36-6686C5C39FEB",
        "duration": 100
    },
    // Update session that doesn't exists
    {
        "session_guid": "8293D504-13EE-447F-9B36-6686C5C39FEB",
        "duration": 100
    }
]'

Example Response:

The response for this operation includes a json object like so:

{
    "approved": [
        // JSON objects for session
    ],
    "rejected": [
        // JSON objects for session
    ]
}

Response Status Codes will vary depending on how the operations went:

  • 200 OK: All operations completed successfully

  • 207 Multi-Status: Partial success - some operations failed

  • 400 Bad Request: All operations failed

{
    "approved": [
        {
            "session_guid": "1B27EB7F-6ECD-42B1-8CEC-4FE78B53A468",
            "name": "CS201",
            "description": null,
            "tags": null,
            "start_date": "2025-08-05T12:00:00+03:00",
            "timezone": "Europe/Istanbul",
            "duration": 120,
            "lang": "en-US",
            "status": 1,
            "replay_status": 0,
            "options": {
                "allow_rating": true,
                "preparation_time": 15,
                "session_duration": 120,
                "chat": {
                    "offMessageModule": false,
                    "offGeneralMsging": false,
                    "offGeneralMsgLimitForUser": false,
                    "offSpecialMsging": false,
                    "offSpecialMsgToAdmin": false,
                    "offSpecialMsgToUser": false,
                    "offNewMsgSound": false,
                    "offClearForReplay": false,
                    "onNewMsgSoundInAll": false,
                    "onNewMsgNotifyInAll": false
                },
                "duration": {
                    "allowExtendTime": true,
                    "useRemainingTime": false
                },
                "allow_users_stream_self_cam_mic": true,
                "hide_user_streams": false,
                "enable_attendance_check": true,
                "enable_simultaneous_interpretation": false,
                "enable_simultaneous_interpretation_for_users": false,
                "start_active": false,
                "return_url": "",
                "allow_reactions": true,
                "enable_recording_auto_start": null,
                "skip_approval_on_join": null,
                "enable_session_auto_start": null,
                "enable_session_auto_finish": null
            },
            "creation_date": "2025-02-06T16:07:35.488565+03:00",
            "updating_date": "2025-02-06T16:07:35.488565+03:00"
        },
        {
            "session_guid": "61E3D504-13EE-447F-9B36-6686C5C39FEB",
            "name": "Web Development 101",
            "description": null,
            "tags": null,
            "start_date": "2025-08-05T12:00:00+03:00",
            "timezone": "Europe/Istanbul",
            "duration": 100,
            "lang": "en-US",
            "status": 1,
            "replay_status": 0,
            "options": {
                "allow_rating": true,
                "preparation_time": 15,
                "session_duration": 100,
                "chat": {
                    "offMessageModule": false,
                    "offGeneralMsging": false,
                    "offGeneralMsgLimitForUser": false,
                    "offSpecialMsging": false,
                    "offSpecialMsgToAdmin": false,
                    "offSpecialMsgToUser": false,
                    "offNewMsgSound": false,
                    "offClearForReplay": false,
                    "onNewMsgSoundInAll": false,
                    "onNewMsgNotifyInAll": false
                },
                "duration": {
                    "allowExtendTime": true,
                    "useRemainingTime": false
                },
                "allow_users_stream_self_cam_mic": true,
                "hide_user_streams": false,
                "enable_attendance_check": true,
                "enable_simultaneous_interpretation": false,
                "enable_simultaneous_interpretation_for_users": false,
                "start_active": false,
                "return_url": "",
                "allow_reactions": true,
                "enable_recording_auto_start": null,
                "skip_approval_on_join": null,
                "enable_session_auto_start": null,
                "enable_session_auto_finish": null
            },
            "creation_date": "2025-02-06T15:23:48.490759+03:00",
            "updating_date": "2025-02-06T16:07:35.488565+03:00"
        }
    ],
    "rejected": [
        {
            "model": {
                "session_id": 0,
                "string_session_id": null,
                "the_guid": "8293D504-13EE-447F-9B36-6686C5C39FEB",
                "name": null,
                "description": null,
                "tags": null,
                "start_date": "1970-01-01T00:00:00+00:00",
                "duration": 100,
                "lang": "en-US",
                "account_id": 1329,
                "realtime_server": null,
                "conference_server": null,
                "file_server": null,
                "status": 1,
                "replay_status": 0,
                "ui_options": "{\"allow_rating\":true,\"preparation_time\":15,\"session_duration\":100,\"Chat\":{\"OffMessageModule\":false,\"OffGeneralMsging\":false,\"OffGeneralMsgLimitForUser\":false,\"OffSpecialMsging\":false,\"OffSpecialMsgToAdmin\":false,\"OffSpecialMsgToUser\":false,\"OffNewMsgSound\":false,\"OffClearForReplay\":false,\"OnNewMsgSoundInAll\":false,\"OnNewMsgNotifyInAll\":false},\"Duration\":{\"AllowExtendTime\":true,\"UseRemainingTime\":false},\"allow_users_stream_self_cam_mic\":true,\"hide_user_streams\":false,\"enable_attendance_check\":true,\"enable_simultaneous_interpretation\":false,\"enable_simultaneous_interpretation_for_users\":false,\"start_active\":false,\"return_url\":\"\",\"allow_reactions\":true,\"enable_recording_auto_start\":null,\"skip_approval_on_join\":null,\"enable_session_auto_start\":null,\"enable_session_auto_finish\":null}",
                "user_started": null,
                "user_finished": null,
                "user_added": 4490,
                "user_updated": 4490,
                "creation_date": null,
                "updating_date": null,
                "custom_field1": null,
                "custom_field2": null,
                "custom_field3": null,
                "custom_field4": null,
                "custom_field5": null,
                "repeating_options": null,
                "replay_access": "on",
                "allow_recording": true,
                "planned_duration": 100,
                "timezone": "Europe/Istanbul",
                "groups": [],
                "attendees": [],
                "owner": null,
                "files": [],
                "questions": [],
                "enrollOptions": null,
                "sessionGroups": [],
                "_isValid": null,
                "_errors": null
            },
            "state": {
                "code": 30,
                "details": "session_not_found"
            }
        },
        {
            "model": {
                "session_guid": null,
                "name": "TR102",
                "description": null,
                "tags": null,
                "start_date": "2020-08-05T14:00:00+00:00",
                "duration": 120,
                "lang": "tr-TR",
                "allow_recording": true,
                "inaccessible_replay": false,
                "options": {
                    "allow_rating": false,
                    "preparation_time": null,
                    "session_duration": null,
                    "chat": null,
                    "duration": null,
                    "allow_users_stream_self_cam_mic": null,
                    "hide_user_streams": null,
                    "enable_attendance_check": null,
                    "enable_simultaneous_interpretation": null,
                    "enable_simultaneous_interpretation_for_users": null,
                    "start_active": null,
                    "return_url": null,
                    "allow_reactions": null,
                    "enable_recording_auto_start": null,
                    "skip_approval_on_join": null,
                    "enable_session_auto_start": null,
                    "enable_session_auto_finish": null
                },
                "timezone": "Europe/Istanbul"
            },
            "state": {
                "code": 12,
                "details": [
                    "Invalid session start date."
                ]
            }
        }
    ]
}

Last updated

Was this helpful?