Get Work Schedule timeman.schedule.get
Scope:
timemanWho can execute the method: any user
The method timeman.schedule.get retrieves the work schedule by its identifier. If no schedule exists with the specified identifier, it will return an empty array.
Method Parameters
|
Name |
Description |
|
id |
Identifier of the schedule. You can find the schedule identifier in the list of schedules on the Employees > Time and Reports > Work Schedules page |
Code Examples
How to Use Examples in Documentation
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"id":1}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/timeman.schedule.get
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"id":1,"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/timeman.schedule.get
try
{
const response = await $b24.callMethod(
"timeman.schedule.get",
{
id: 1
}
);
const result = response.getData().result;
console.dir(result);
if(response.more())
response.next();
}
catch(error)
{
console.error(error);
}
try {
$response = $b24Service
->core
->call(
'timeman.schedule.get',
[
'id' => 1
]
);
$result = $response
->getResponseData()
->getResult();
if ($result->error()) {
error_log($result->error());
echo 'Error: ' . $result->error();
} else {
var_dump($result->data());
if ($result->more()) {
$result->next();
}
}
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error getting schedule: ' . $e->getMessage();
}
BX24.callMethod(
"timeman.schedule.get",
{
id: 1
},
function(result)
{
if(result.error())
console.error(result.error());
else
{
console.dir(result.data());
if(result.more())
result.next();
}
}
);
require_once('crest.php');
$result = CRest::call(
'timeman.schedule.get',
[
'id' => 1
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
Response Handling
HTTP Status: 200
{
"result": {
"ID": 1,
"NAME": "For all employees",
"SCHEDULE_TYPE": "FIXED",
"REPORT_PERIOD": "MONTH",
"REPORT_PERIOD_OPTIONS": {
"START_WEEK_DAY": 0
},
"CALENDAR_ID": 1,
"ALLOWED_DEVICES": {
"browser": true
},
"DELETED": "0",
"IS_FOR_ALL_USERS": true,
"WORKTIME_RESTRICTIONS": [
"[]"
],
"CONTROLLED_ACTIONS": 3,
"UPDATED_BY": 503,
"DELETED_BY": 0,
"DELETED_AT": "",
"CREATED_BY": 0,
"CREATED_AT": "2019-09-19T21:22:22+02:00",
"SHIFTS": [
{
"ID": 1,
"NAME": "",
"BREAK_DURATION": 3600,
"WORK_TIME_START": 28800,
"WORK_TIME_END": 61200,
"WORK_DAYS": "12345",
"SCHEDULE_ID": 1,
"DELETED": false
}
],
"CALENDAR": {
"ID": 1,
"NAME": "",
"PARENT_CALENDAR_ID": 0,
"SYSTEM_CODE": "",
"EXCLUSIONS": []
},
"SCHEDULE_VIOLATION_RULES": {
"ID": 1,
"SCHEDULE_ID": 1,
"ENTITY_CODE": "UA",
"MAX_EXACT_START": 28859,
"MIN_EXACT_END": 61200,
"MAX_OFFSET_START": -1,
"MIN_OFFSET_END": -1,
"RELATIVE_START_FROM": -1,
"RELATIVE_START_TO": -1,
"RELATIVE_END_FROM": -1,
"RELATIVE_END_TO": -1,
"MIN_DAY_DURATION": 28800,
"MAX_ALLOWED_TO_EDIT_WORK_TIME": 300,
"MAX_WORK_TIME_LACK_FOR_PERIOD": 3600,
"PERIOD_TIME_LACK_AGENT_ID": 309429,
"MAX_SHIFT_START_DELAY": -1,
"MISSED_SHIFT_START": 0,
"USERS_TO_NOTIFY": {
"FIXED_START_END": [
"U503"
],
"FIXED_PER_RECORD": [
"U503"
],
"FIXED_EDIT_WORKTIME": [
"U503"
],
"FIXED_PERIODIC": [
"U503"
],
"SHIFT_DELAY": [],
"SHIFT_MISSED_START": []
}
}
},
"time": {
"start": 1744036659.2339499,
"finish": 1744036659.2655749,
"duration": 0.031625032424926758,
"processing": 0.008758068084716797,
"date_start": "2025-04-07T17:37:39+02:00",
"date_finish": "2025-04-07T17:37:39+02:00",
"operating_reset_at": 1744037259,
"operating": 0
}
}
Returned Data
|
Name |
Description |
|
result |
Root element of the response. Contains an object with the description of the employees' work schedule |
|
ID |
Identifier of the work schedule |
|
NAME |
Name of the work schedule |
|
SCHEDULE_TYPE |
Type of the work schedule. Possible values:
|
|
REPORT_PERIOD |
Frequency of report generation for the schedule. Possible values:
|
|
REPORT_PERIOD_OPTIONS |
Object with the description of additional settings for report generation period. Only for |
|
CALENDAR_ID |
Identifier of the calendar associated with the work schedule |
|
ALLOWED_DEVICES |
Object with the description of allowed devices for time tracking |
|
DELETED |
Flag indicating if the work schedule is deleted. Value |
|
IS_FOR_ALL_USERS |
Applicability of the schedule to all employees. Value |
|
WORKTIME_RESTRICTIONS |
Work time restrictions. Contains an array of strings with restriction rules |
|
CONTROLLED_ACTIONS |
Number of controlled actions within the work schedule |
|
UPDATED_BY |
Identifier of the user who last updated the work schedule |
|
DELETED_BY |
Identifier of the user who deleted the work schedule. Value |
|
DELETED_AT |
Date and time of deletion of the work schedule. An empty string means that the schedule has not been deleted |
|
CREATED_BY |
Identifier of the user who created the work schedule. Value |
|
CREATED_AT |
Date and time of creation of the work schedule |
|
SHIFTS |
Array of shift objects. Each object contains a description of the shift associated with the work schedule |
|
CALENDAR |
Object with information about the calendar associated with the work schedule |
|
SCHEDULE_VIOLATION_RULES |
Object with the description of schedule violation rules |
|
time |
Information about the request execution time |
Object REPORT_PERIOD_OPTIONS
|
Name |
Description |
|
START_WEEK_DAY |
Day the week starts. Possible values:
|
Object ALLOWED_DEVICES
|
Name |
Description |
|
browser |
Is time tracking allowed through the browser. If |
Object SHIFTS
|
Name |
Description |
|
ID |
Identifier of the shift |
|
NAME |
Name of the shift |
|
BREAK_DURATION |
Duration of the break in seconds |
|
WORK_TIME_START |
Start time of the workday in seconds from midnight |
|
WORK_TIME_END |
End time of the workday in seconds from midnight |
|
WORK_DAYS |
String with codes of workdays. For example, |
|
SCHEDULE_ID |
Identifier of the work schedule |
|
DELETED |
Flag indicating if the shift is deleted. Value |
Object CALENDAR
|
Name |
Description |
|
ID |
Identifier of the calendar |
|
NAME |
Name of the calendar |
|
PARENT_CALENDAR_ID |
Identifier of the parent calendar. Value |
|
SYSTEM_CODE |
System code of the calendar |
|
EXCLUSIONS |
Exclusions from the calendar. Contains an array of strings with dates or periods excluded from the calendar |
Object SCHEDULE_VIOLATION_RULES
|
Name |
Description |
|
ID |
Identifier of the schedule violation rules |
|
SCHEDULE_ID |
Identifier of the work schedule |
|
ENTITY_CODE |
Code of the entity to which the rules apply. For example, |
|
MAX_EXACT_START |
Maximum exact start time of the workday in seconds from midnight |
|
MIN_EXACT_END |
Minimum exact end time of the workday in seconds from midnight |
|
MAX_OFFSET_START |
Maximum offset for the start of the workday. Value |
|
MIN_OFFSET_END |
Minimum offset for the end of the workday. Value |
|
RELATIVE_START_FROM |
Relative start of the workday (relative to the planned time). Value |
|
RELATIVE_START_TO |
Relative end of the workday (relative to the planned time). Value |
|
RELATIVE_END_FROM |
Relative start of the end of the workday. Value |
|
RELATIVE_END_TO |
Relative end of the workday. Value |
|
MIN_DAY_DURATION |
Minimum duration of the workday in seconds |
|
MAX_ALLOWED_TO_EDIT_WORK_TIME |
Maximum time allowed to edit work time in seconds |
|
MAX_WORK_TIME_LACK_FOR_PERIOD |
Maximum time of underwork for the period in seconds |
|
PERIOD_TIME_LACK_AGENT_ID |
Identifier of the agent checking underwork for the period |
|
MAX_SHIFT_START_DELAY |
Maximum delay for the start of the shift in seconds. Value |
|
MISSED_SHIFT_START |
Flag indicating if the start of the shift was missed. Value |
|
USERS_TO_NOTIFY |
Object with the description of users for notifying about schedule violations |
Object USERS_TO_NOTIFY
|
Name |
Description |
|
FIXED_START_END |
List of users to notify about fixed start and end of the workday. Each element of the array contains the user identifier in the format |
|
FIXED_PER_RECORD |
List of users to notify about fixed time records. Each element of the array contains the user identifier in the format |
|
FIXED_EDIT_WORKTIME |
List of users to notify about changes in work time. Each element of the array contains the user identifier in the format |
|
FIXED_PERIODIC |
List of users to notify about periodic schedule violations. Each element of the array contains the user identifier in the format |
|
SHIFT_DELAY |
List of users to notify about delays in the start of the shift |
|
SHIFT_MISSED_START |
List of users to notify about missed starts of the shift |
Error Handling
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 |