SetIntervals

[POST] .../v1/channel/setintervals

Replaces the full schedule interval list for a CRM channel. Use this workflow method after Channel/Add or Channel/Get to replace all working intervals for one CRM channel. The method deletes the previous interval list, inserts the provided intervals, invalidates the CRM channel cache and returns row_affected with the channel id; an empty array clears the schedule and means 24/7 mode. The request body is required, channel_id must be positive, intervals must not be null, day_of_week must be 1.7, start_minute and end_minute must be 0.1439, start_minute must differ from end_minute and cross_day is valid only when the interval actually crosses midnight. The caller must have CRM channel edit permission; missing body, invalid channel_id or intervals, denied access, missing channel, database failures, transaction failures and action-log errors are returned as HTTP 200 ErrorResult business errors.

Request Parameters

Name Type Required Description
channel_id Int64 Required Channel ID.
intervals Array of ChannelSetInterval Required New schedule intervals. An empty array clears the schedule and means 24/7 mode.

Request Example

{
  "channel_id": 3,
  "intervals": [
    {
      "day_of_week": 1,
      "start_minute": 540,
      "end_minute": 1080,
      "cross_day": false
    },
    {
      "day_of_week": 2,
      "start_minute": 540,
      "end_minute": 1080,
      "cross_day": false
    }
  ]
}

Response Parameters

Name Type Description
ok Boolean Indicates whether the request completed successfully.
result Update Update operation result.

Response Example

{
  "ok": true,
  "result": {
    "row_affected": 1,
    "ids": [
      3
    ]
  }
}