Get Work Schedule timeman.schedule.get

Scope: timeman

Who 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
type

Description

id
integer

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
type

Description

result
object

Root element of the response.

Contains an object with the description of the employees' work schedule

ID
integer

Identifier of the work schedule

NAME
string

Name of the work schedule

SCHEDULE_TYPE
string

Type of the work schedule.

Possible values:

  • FIXED — fixed
  • SHIFT — shift-based
  • FLEXTIME — flexible

REPORT_PERIOD
string

Frequency of report generation for the schedule.

Possible values:

  • MONTH — month
  • WEEK — week
  • TWO_WEEKS — two weeks
  • QUARTER — quarter

REPORT_PERIOD_OPTIONS
object

Object with the description of additional settings for report generation period.

Only for REPORT_PERIOD with values WEEK and TWO_WEEKS

CALENDAR_ID
integer

Identifier of the calendar associated with the work schedule

ALLOWED_DEVICES
object

Object with the description of allowed devices for time tracking

DELETED
string

Flag indicating if the work schedule is deleted.

Value "0" means the schedule is active. Value "1" indicates a deleted state

IS_FOR_ALL_USERS
boolean

Applicability of the schedule to all employees.

Value true means the schedule applies to all users of the system

WORKTIME_RESTRICTIONS
array

Work time restrictions.

Contains an array of strings with restriction rules

CONTROLLED_ACTIONS
integer

Number of controlled actions within the work schedule

UPDATED_BY
integer

Identifier of the user who last updated the work schedule

DELETED_BY
integer

Identifier of the user who deleted the work schedule.

Value 0 indicates that the schedule has not been deleted

DELETED_AT
string

Date and time of deletion of the work schedule.

An empty string means that the schedule has not been deleted

CREATED_BY
integer

Identifier of the user who created the work schedule.

Value 0 indicates system creation

CREATED_AT
datetime

Date and time of creation of the work schedule

SHIFTS
array

Array of shift objects. Each object contains a description of the shift associated with the work schedule

CALENDAR
object

Object with information about the calendar associated with the work schedule

SCHEDULE_VIOLATION_RULES
object

Object with the description of schedule violation rules

time
time

Information about the request execution time

Object REPORT_PERIOD_OPTIONS

Name
type

Description

START_WEEK_DAY
integer

Day the week starts.

Possible values:

  • 0 — Monday
  • 1 — Tuesday
  • 2 — Wednesday
  • 3 — Thursday
  • 4 — Friday
  • 5 — Saturday
  • 6 — Sunday

Object ALLOWED_DEVICES

Name
type

Description

browser
boolean

Is time tracking allowed through the browser.

If true — tracking is allowed

Object SHIFTS

Name
type

Description

ID
integer

Identifier of the shift

NAME
string

Name of the shift

BREAK_DURATION
integer

Duration of the break in seconds

WORK_TIME_START
integer

Start time of the workday in seconds from midnight

WORK_TIME_END
integer

End time of the workday in seconds from midnight

WORK_DAYS
string

String with codes of workdays. For example, 12345 — from Monday to Friday

SCHEDULE_ID
integer

Identifier of the work schedule

DELETED
boolean

Flag indicating if the shift is deleted.

Value true means the shift is deleted

Object CALENDAR

Name
type

Description

ID
integer

Identifier of the calendar

NAME
string

Name of the calendar

PARENT_CALENDAR_ID
integer

Identifier of the parent calendar.

Value 0 indicates that there is no parent calendar

SYSTEM_CODE
string

System code of the calendar

EXCLUSIONS
array

Exclusions from the calendar.

Contains an array of strings with dates or periods excluded from the calendar

Object SCHEDULE_VIOLATION_RULES

Name
type

Description

ID
integer

Identifier of the schedule violation rules

SCHEDULE_ID
integer

Identifier of the work schedule

ENTITY_CODE
string

Code of the entity to which the rules apply.

For example, UA — user actions

MAX_EXACT_START
integer

Maximum exact start time of the workday in seconds from midnight

MIN_EXACT_END
integer

Minimum exact end time of the workday in seconds from midnight

MAX_OFFSET_START
integer

Maximum offset for the start of the workday.

Value -1 means no restriction is set

MIN_OFFSET_END
integer

Minimum offset for the end of the workday.

Value -1 means no restriction is set

RELATIVE_START_FROM
integer

Relative start of the workday (relative to the planned time).

Value -1 means no restriction is set

RELATIVE_START_TO
integer

Relative end of the workday (relative to the planned time).

Value -1 means no restriction is set

RELATIVE_END_FROM
integer

Relative start of the end of the workday.

Value -1 means no restriction is set

RELATIVE_END_TO
integer

Relative end of the workday.

Value -1 means no restriction is set

MIN_DAY_DURATION
integer

Minimum duration of the workday in seconds

MAX_ALLOWED_TO_EDIT_WORK_TIME
integer

Maximum time allowed to edit work time in seconds

MAX_WORK_TIME_LACK_FOR_PERIOD
integer

Maximum time of underwork for the period in seconds

PERIOD_TIME_LACK_AGENT_ID
integer

Identifier of the agent checking underwork for the period

MAX_SHIFT_START_DELAY
integer

Maximum delay for the start of the shift in seconds.

Value -1 means no restriction is set

MISSED_SHIFT_START
integer

Flag indicating if the start of the shift was missed.

Value 0 means no missed start was recorded

USERS_TO_NOTIFY
object

Object with the description of users for notifying about schedule violations

Object USERS_TO_NOTIFY

Name
type

Description

FIXED_START_END
array

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 U<ID>

FIXED_PER_RECORD
array

List of users to notify about fixed time records.

Each element of the array contains the user identifier in the format U<ID>

FIXED_EDIT_WORKTIME
array

List of users to notify about changes in work time.

Each element of the array contains the user identifier in the format U<ID>

FIXED_PERIODIC
array

List of users to notify about periodic schedule violations.

Each element of the array contains the user identifier in the format U<ID>

SHIFT_DELAY
array

List of users to notify about delays in the start of the shift

SHIFT_MISSED_START
array

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
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