Get the list of calendars calendar.section.get
Scope:
calendarWho can execute the method: any user
This method retrieves a list of calendars.
Method Parameters
Required parameters are marked with *
|
Name |
Description |
|
type* |
Calendar type:
|
|
ownerId* |
Calendar owner identifier. For the |
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 |
Description |
|
result |
Array of calendars |
|
ID |
Calendar identifier |
|
NAME |
Calendar name |
|
GAPI_CALENDAR_ID |
Synchronization identifier |
|
DESCRIPTION |
Calendar description |
|
COLOR |
Calendar color |
|
TEXT_COLOR |
Text color in the calendar |
|
EXPORT |
Object with calendar export parameters |
|
CAL_TYPE |
Calendar type |
|
OWNER_ID |
Calendar owner identifier. For the user calendar type |
|
CREATED_BY |
Calendar creator identifier |
|
DATE_CREATE |
Calendar creation date |
|
TIMESTAMP_X |
Calendar modification date |
|
CAL_DAV_CON |
Synchronization identifier |
|
SYNC_TOKEN |
Synchronization identifier |
|
PAGE_TOKEN |
Synchronization identifier |
|
EXTERNAL_TYPE |
Provider type for synchronization |
|
ACCESS |
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 |
Flag indicating whether the calendar belongs to collaboration |
|
PERM |
Object access permissions for the current user to the calendar |
EXPORT Object
|
Name |
Description |
|
ALLOW |
Calendar export is allowed |
PERM Object
|
Name |
Description |
|
view_time |
View calendar event times |
|
view_title |
View calendar event titles |
|
view_full |
Full access to calendar event information |
|
add |
Add events to the calendar |
|
edit |
Edit events in the calendar |
|
edit_section |
Edit the calendar |
|
access |
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 |
Description |
|
error |
String error code. It may consist of digits, Latin letters, and underscores |
|
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 |
|
Empty string |
The required parameter "ownerId" for the method "calendar.section.get" is not set |
The required parameter |
|
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 |
Description |
|
|
|
An internal server error has occurred, please contact the server administrator or Bitrix24 technical support |
|
|
|
An internal server error has occurred, please contact the server administrator or Bitrix24 technical support |
|
|
|
The request intensity limit has been exceeded |
|
|
|
The current method is not allowed to be called using batch |
|
|
|
The maximum length of parameters passed to the batch method has been exceeded |
|
|
|
Invalid access token or webhook code |
|
|
|
The methods must be called using the HTTPS protocol |
|
|
|
The REST API is blocked due to overload. This is a manual individual block, to remove it you need to contact Bitrix24 technical support |
|
|
|
The REST API is available only on commercial plans |
|
|
|
The user whose access token or webhook was used to call the method lacks permissions |
|
|
|
The manifest is not available |
|
|
|
The request requires higher privileges than those provided by the webhook token |
|
|
|
The provided access token has expired |
|
|
|
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 |
|
|
|
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
- Calendar: Overview of Methods
- Add Calendar calendar.section.add
- Update Calendar calendar.section.update
- Delete Calendar calendar.section.delete