Skip to content

Retrieves work schedules.

Retrieves work schedules

Method get.schedules
Description Retrieves work schedules.
Who has access Agents and clients

Request parameters

Name Type Required Description
access_token string yes Access token used to authenticate the request.
user_id number no Unique ID of the client user on whose behalf the agent is making the request. Required for agents. To retrieve a list of client users, use "get.customer_users".
limit number no Maximum number of records to return. See the "Paging" section.
offset number no Number of records to skip before returning results. Default: 0. See the "Paging" section.
filter object no Filtering criteria. See the "Filters" section.
fields array no Fields to include in the response. See the "Viewing returned data" section.
sort array no Sorting criteria. See the "Data sorting" section.

Response parameters

Name Type Valid values Filtering Sorting Description
id number yes Unique work schedule ID.
name string yes yes Work schedule name.
Schedule rules
schedules array yes Rules that define when the work schedule is active.
activity_days object Days on which this schedule rule is active.
type enum days_of_week; days_of_month; business_calendar; cycle Schedule type: days_of_week - weekly schedule; days_of_month - monthly schedule by calendar date; business_calendar - schedule based on the business calendar; cycle - repeating work/rest cycle.
days array For days_of_week: 0 - Sunday; 1 - Monday; 2 - Tuesday; 3 - Wednesday; 4 - Thursday; 5 - Friday; 6 - Saturday. For days_of_month: integers from 1 to 31. For cycle: [working days, non-working days]. For business_calendar: 7 - working days; 8 - non-working days. Days on which the rule is active. For a cycle, [2, 2] means two working days followed by two non-working days. For a business calendar, [7] selects working days and [8] selects non-working days.
Active time ranges
activity_time array Time ranges during which the rule is active. If omitted, the rule is active all day.
time_from string HH:MM Start time of the active range.
time_till string HH:MM End time of the active range. Must be later than time_from.
Active date range
activity_date_from string YYYY-MM-DD Start date of the active period.
activity_date_till string YYYY-MM-DD End date of the active period.

Example request

{
  "jsonrpc":"2.0",
  "id":"number",
  "method":"get.schedules",
  "params":{
    "access_token":"string",
    "user_id":"number",
    "offset":"number",
    "limit":"number",
    "filter":{
    },
    "sort":[
      {
        "field":"string",
        "order":"string"
      }
    ],
    "fields":[
      "string"
    ]
  }
}

Example response

{
  "jsonrpc":"2.0",
  "id":"number",
  "result":{
    "metadata":{
    },
    "data":[
      {
        "id":"number",
        "name":"string",
        "schedules":[
          {
            "activity_days":{
              "type":"enum",
              "days":[
              ]
            },
            "activity_time":[
              {
                "time_from":"string",
                "time_till":"string"
              }
            ],
            "activity_date_from":"string",
            "activity_date_till":"string"
          }
        ]
      }
    ]
  }
}

Possible errors

See the "Errors for get methods" section.