This document is for an older version of Kazoo (version 4.3) that is no longer supported. You should upgrade and read the current documentation.

Temporal Rules

About Temporal Rules

Temporal rules provide a flexible way to configure time-based Call routing, e.g. open hours, holidays, close hours, etc…

Schema

Schema for a temporal rules

KeyDescriptionTypeDefaultRequiredSupport Level
cycleThe recurrence cycle for this rule`string(‘date''daily''weekly''monthly'
daysThe recurrence days for this rulearray(integer())falsesupported
enabledWhether the rule is enabledboolean()false
flags.[]string()falsesupported
flagsFlags set by external applicationsarray(string())falsesupported
intervalThe recurrence interval for this ruleinteger()1falsesupported
monthThe recurrence month for this ruleinteger()falsesupported
nameA friendly name for the temporal rulestring(1..128)truesupported
ordinalThe recurrence ordinal for this rule`string(‘every''first''second''third'
start_dateThe date that any recurrence should be calculated as starting oninteger()62586115200falsesupported
time_window_startSeconds from the start of a day to consider this rule validinteger()falsesupported
time_window_stopSeconds from the start of a day to stop considering this rule validinteger()falsesupported
wdays.[]`string(‘monday''tuesday''wednesday''wensday'
wdaysThe recurrence weekdays for this rule`array(string(‘monday''tuesday''wednesday''wensday'

Notes on fields

enabled

Unless you need to override a time of day rule (for example keep an office open longer) keep the property unset.

start_date

It is recommended that a start date always be set to some time in the past if this control is not required to ensure it takes effect on the next cycle.

Setting this property is especially important when using an interval other than 1. For example if the rule should be applied every other year and the start date is in 2010, then it will be active on 2010, 2012, 2014, etc. However, if the start date was in 2011 then it will be active on 2011, 2013, 2015, etc.

ordinal

Not all months have a fifth occurrence of a weekday; the rule is ignored if that is the case.

cycle

When cycle is date, the rule only considers start_date and matches it against the current day.

days

The days array is only valid when cycle is yearly or monthly.

Fetch

GET /v2/accounts/{ACCOUNT_ID}/temporal_rules

curl -v -X GET \
    -H "X-Auth-Token: {AUTH_TOKEN}" \
    http://{SERVER}:8000/v2/accounts/{ACCOUNT_ID}/temporal_rules
{
   "auth_token":"{AUTH_TOKEN}",
   "status":"success",
   "request_id":"{REQUEST_ID}",
   "revision":"{REVISION}",
   "data":[
      {
         "id":"{TEMPORAL_RULE_ID}",
         "name":"Business Hours"
      },
      {
         "id":"{TEMPORAL_RULE_ID}",
         "name":"Holiday"
      }
   ]
}

Create

PUT /v2/accounts/{ACCOUNT_ID}/temporal_rules

curl -v -X PUT \
    -H "X-Auth-Token: {AUTH_TOKEN}" \
    -d '{"data":{"time_window_start":0,"time_window_stop":86400,"days":[25],"name":"Christmas","cycle":"yearly","start_date":62586115200,"month":12,"ordinal":"every","interval":1}}'
    http://{SERVER}:8000/v2/accounts/{ACCOUNT_ID}/temporal_rules
{
   "auth_token":"{AUTH_TOKEN}",
   "status":"success",
   "request_id":"{REQUEST_ID}",
   "revision":"{REVISION}",
   "data":{
      "time_window_start":0,
      "time_window_stop":86400,
      "days":[25],
      "name":"Christmas",
      "cycle":"yearly",
      "start_date":62586115200,
      "month":12,
      "ordinal":"every",
      "interval":1
   }
}

Fetch

GET /v2/accounts/{ACCOUNT_ID}/temporal_rules/{TEMPORAL_RULE_ID}

curl -v -X GET \
    -H "X-Auth-Token: {AUTH_TOKEN}" \
    http://{SERVER}:8000/v2/accounts/{ACCOUNT_ID}/temporal_rules/{TEMPORAL_RULE_ID}

Change

POST /v2/accounts/{ACCOUNT_ID}/temporal_rules/{TEMPORAL_RULE_ID}

curl -v -X POST \
    -H "X-Auth-Token: {AUTH_TOKEN}" \
    http://{SERVER}:8000/v2/accounts/{ACCOUNT_ID}/temporal_rules/{TEMPORAL_RULE_ID}

Patch

PATCH /v2/accounts/{ACCOUNT_ID}/temporal_rules/{TEMPORAL_RULE_ID}

curl -v -X PATCH \
    -H "X-Auth-Token: {AUTH_TOKEN}" \
    http://{SERVER}:8000/v2/accounts/{ACCOUNT_ID}/temporal_rules/{TEMPORAL_RULE_ID}

Remove

DELETE /v2/accounts/{ACCOUNT_ID}/temporal_rules/{TEMPORAL_RULE_ID}

curl -v -X DELETE \
    -H "X-Auth-Token: {AUTH_TOKEN}" \
    http://{SERVER}:8000/v2/accounts/{ACCOUNT_ID}/temporal_rules/{TEMPORAL_RULE_ID}