Get the list of calendars calendar.section.get

Scope: calendar

Who can execute the method: any user

This method retrieves a list of calendars.

Method Parameters

Required parameters are marked with *

Name
type

Description

type*
string

Calendar type:

  • user — user calendar
  • group — group calendar
  • company_calendar — company calendar
  • location — meeting room calendar. Used for booking time in the meeting room calendar through a third-party application
  • other types, including custom

ownerId*
integer

Calendar owner identifier.

For the location calendar type, the ownerId parameter must be set to 0

Code Examples

How to Use Examples in Documentation

curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"type":"user","ownerId":1}' \
        https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/calendar.section.get
        
curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"type":"user","ownerId":1,"auth":"**put_access_token_here**"}' \
        https://**put_your_bitrix24_address**/rest/calendar.section.get
        
try
        {
        	const response = await $b24.callMethod(
        		'calendar.section.get',
        		{
        			type: 'user',
        			ownerId: 1
        		}
        	);
        	
        	const result = response.getData().result;
        	console.log(result);
        }
        catch( error )
        {
        	console.error('Error:', error);
        }
        
try {
            $response = $b24Service
                ->core
                ->call(
                    'calendar.section.get',
                    [
                        'type'    => 'user',
                        'ownerId' => 1
                    ]
                );
        
            $result = $response
                ->getResponseData()
                ->getResult();
        
            echo 'Success: ' . print_r($result, true);
            // Your logic for processing data
            processData($result);
        
        } catch (Throwable $e) {
            error_log($e->getMessage());
            echo 'Error getting calendar section: ' . $e->getMessage();
        }
        
BX24.callMethod(
            'calendar.section.get',
            {
                type: 'user',
                ownerId: 1
            }
        );
        
require_once('crest.php');
        
        $result = CRest::call(
            'calendar.section.get',
            [
                'type' => 'user',
                'ownerId' => 1
            ]
        );
        
        echo '<PRE>';
        print_r($result);
        echo '</PRE>';
        

Response Handling

HTTP status: 200

{
            "result": [
                {
                    "ID": "190",
                    "NAME": "New Section",
                    "GAPI_CALENDAR_ID": null,
                    "DESCRIPTION": "Description for section",
                    "COLOR": "#9cbeee",
                    "TEXT_COLOR": "#283000",
                    "EXPORT": {
                        "ALLOW": true
                    },
                    "CAL_TYPE": "user",
                    "OWNER_ID": "1",
                    "CREATED_BY": "1",
                    "DATE_CREATE": "2024-12-10 06:36:00",
                    "TIMESTAMP_X": "2024-12-10 06:36:00",
                    "CAL_DAV_CON": null,
                    "SYNC_TOKEN": null,
                    "PAGE_TOKEN": null,
                    "EXTERNAL_TYPE": "local",
                    "ACCESS": {
                        "D114": 17,
                        "G2": 13,
                        "U2": 15,
                        "U1": 19
                    },
                    "IS_COLLAB": false,
                    "PERM": {
                        "view_time": true,
                        "view_title": true,
                        "view_full": true,
                        "add": true,
                        "edit": true,
                        "edit_section": true,
                        "access": true
                    }
                },
                {
                    "ID": "191",
                    ...
                }
                {
                    "ID": "192",
                    ...
                }
            ],
            "time": {
                "start": 1733828946.418185,
                "finish": 1733828946.650208,
                "duration": 0.23202300071716309,
                "processing": 0.0054471492767333984,
                "date_start": "2024-12-08T11:09:06+00:00",
                "date_finish": "2024-12-08T11:09:06+00:00"
            }
        }
        

Returned Data

Name
type

Description

result
array

Array of calendars

ID
string

Calendar identifier

NAME
string

Calendar name

GAPI_CALENDAR_ID
string

Synchronization identifier

DESCRIPTION
string

Calendar description

COLOR
string

Calendar color

TEXT_COLOR
string

Text color in the calendar

EXPORT
object

Object with calendar export parameters

CAL_TYPE
string

Calendar type

OWNER_ID
string

Calendar owner identifier.

For the user calendar type user, the field contains the user identifier. For the group calendar group, it contains the group identifier

CREATED_BY
string

Calendar creator identifier

DATE_CREATE
datetime

Calendar creation date

TIMESTAMP_X
datetime

Calendar modification date

CAL_DAV_CON
string

Synchronization identifier

SYNC_TOKEN
string

Synchronization identifier

PAGE_TOKEN
string

Synchronization identifier

EXTERNAL_TYPE
string

Provider type for synchronization

ACCESS
object

Object containing access data for the calendar.

The object key is the access permission identifier. You can get the name of the access permission using the access.name method. Determine access permissions for the current user using the user.access method.

The object value contains the numerical identifier of the access permission. Access permission identifiers differ across different accounts. Currently, only the account administrator in the on-premise version of Bitrix24 can find out all identifiers

IS_COLLAB
boolean

Flag indicating whether the calendar belongs to collaboration

PERM
object

Object access permissions for the current user to the calendar

EXPORT Object

Name
type

Description

ALLOW
boolean

Calendar export is allowed

PERM Object

Name
type

Description

view_time
boolean

View calendar event times

view_title
boolean

View calendar event titles

view_full
boolean

Full access to calendar event information

add
boolean

Add events to the calendar

edit
boolean

Edit events in the calendar

edit_section
boolean

Edit the calendar

access
boolean

Full access to the calendar

Error Handling

HTTP status: 400

{
            "error": "",
            "error_description": "The required parameter "type" for the method "calendar.section.get" is not set"
        }
        

Name
type

Description

error
string

String error code. It may consist of digits, Latin letters, and underscores

error_description
error_description

Textual description of the error. The description is not intended to be shown to the end user in its raw form

Possible Error Codes

Code

Error Message

Description

Empty string

The required parameter "type" for the method "calendar.section.get" is not set

The required parameter type was not provided

Empty string

The required parameter "ownerId" for the method "calendar.section.get" is not set

The required parameter ownerId was not provided and the type parameter is not equal to user

Empty string

Access denied

Access to the method is denied for external users

Statuses and System Error Codes

HTTP Status: 20x, 40x, 50x

The errors described below may occur when calling any method.

Status

Code
Error Message

Description

500

INTERNAL_SERVER_ERROR
Internal server error

An internal server error has occurred, please contact the server administrator or Bitrix24 technical support

500

ERROR_UNEXPECTED_ANSWER
Server returned an unexpected response

An internal server error has occurred, please contact the server administrator or Bitrix24 technical support

503

QUERY_LIMIT_EXCEEDED
Too many requests

The request intensity limit has been exceeded

405

ERROR_BATCH_METHOD_NOT_ALLOWED
Method is not allowed for batch usage

The current method is not allowed to be called using batch

400

ERROR_BATCH_LENGTH_EXCEEDED
Max batch length exceeded

The maximum length of parameters passed to the batch method has been exceeded

401

NO_AUTH_FOUND
Wrong authorization data

Invalid access token or webhook code

400

INVALID_REQUEST
Https required

The methods must be called using the HTTPS protocol

503

OVERLOAD_LIMIT
REST API is blocked due to overload

The REST API is blocked due to overload. This is a manual individual block, to remove it you need to contact Bitrix24 technical support

403

ACCESS_DENIED
REST API is available only on commercial plans

The REST API is available only on commercial plans

403

INVALID_CREDENTIALS
Invalid request credentials

The user whose access token or webhook was used to call the method lacks permissions

404

ERROR_MANIFEST_IS_NOT_AVAILABLE
Manifest is not available

The manifest is not available

403

insufficient_scope
The request requires higher privileges than provided by the webhook token

The request requires higher privileges than those provided by the webhook token

401

expired_token
The access token provided has expired

The provided access token has expired

403

user_access_error
The user does not have access to the application

The user does not have access to the application. This means that the application is installed, but the account administrator has allowed access to this application only for specific users

500

PORTAL_DELETED
Portal was deleted

The public part of the site is closed. To open the public part of the site on an on-premise installation, disable the option "Temporary closure of the public part of the site". Path to the setting: Desktop > Settings > Product Settings > Module Settings > Main Module > Temporary closure of the public part of the site

Continue Learning