See also:
telecoms.dayparting functionspublicholiday.region.getpublicholiday.region.listtimezone.listUsed to edit an existing dayparting.
Apart from having a daypartingID argument with which to identify the dayparting you wish to edit, the arguments are
identical to those in ?php print funclink('telecoms.dayparting.create'); ?>, although with the calendar argument
you only need to specify the days you wish to change.
You must specify the daypartingID argument, and if (and only if) you're editing a dayparting in a sub-account, you need to
specify the custID argument to identify the sub-account. Other than that, all other arguments are optional. You only need
to supply arguments for the elements you wish to change, though you may provide the full set if you wish.
The calendar argument, if specified, may only contain some days. These days will be changed but all others will be
left as they were.
Note that whilst all of the arguments (apart from daypartingID) are optional, the dayparting must
remain consistent with itself. This means for example that if you decide to update the destinations by supplying a new list of destinations
in the dests argument and in doing so you fail to provide one with a destseq value that is referenced in some of
the calendar segments, the API will disallow the edit and instead return an error.
| arg | required? | syntax | info |
|---|---|---|---|
daypartingID | Y | posint | Identifies the dayparting you wish to edit |
dests | N | list:assoc | A list of destinations (eg phone numbers, voicemails, etc) that calls can be sent to depending on the day and time |
calendar | N | list:assoc | An object containing a list of days of the week and within those, the routing choices for different times of the day |
desc | N | string | A short textual description of the dayparting object |
timezone | N | string | The time zone local to the users/customers who will be using this dayparting; defaults to Europe/London |
holiday_like | N | enum:monday|tuesday|wednesday|thursday|friday|saturday|sunday | The day of week in your calendar that public holidays should behave like |
holiday_regions | N | list:string | A list of regions whose public holidays apply to those who will be receiving calls via this dayparting |
custID | N | posint | custID of the account that owns the dayparting being edited (defaults to the current account). You only need to specify this if you are editing a dayparting in a sub-account. |
The daypartingID argument identifies which dayparting you wish to edit. This will be the daypartingID
value returned by telecoms.dayparting.create when the dayparting was created. It is also returned by
telecoms.dayparting.list.
This argument matches the same named argument in telecoms.dayparting.create desribed at telecoms.dayparting.create:calendar
but with the exception that you don't have to supply all days of the week. Any days you supply will be changed to match what you specify
but any days you omit will remain unchanged.
Calling telecoms.dayparting.get to fetch a dayparting's detail, calling telecoms.dayparting.edit to change it and then calling telecoms.dayparting.get again to confirm the changes.
telecoms.dayparting.get returns the dayparting definition within the "results" sub-object.
You will note that the time segments have the time in hours minutes and seconds, not just hours and minutes. This is how dayparting
time segments are stored internally. When specifying time segments, you may put the seconds on if you wish, but if you don't then
the seconds will be assumed to be :00.
JSON example request:
POST https://live.apicontrol.co.uk/1/json
{
"auth" : {
"username" : "YOURUSERNAME",
"password" : "YOURPASSWORD",
},
"func" : "telecoms.dayparting.get",
"args" : {
"daypartingID" : 2850
}
}
JSON example response:
{
"results" : {
"custID" : 16526,
"daypartingID" : 2850,
"desc" : "DP test",
"dests" : [
{ "destseq" : 1, "dest_type" : "ddi", "ddi" : "+441276500500" },
{ "destseq" : 2, "dest_type" : "voicemail", "mailboxID" : 1649 }
],
"calendar" : {
"monday" : [
{ "starttime" : "00:00:00", "destseq" : 2 },
{ "starttime" : "09:00:00", "destseq" : 1 },
{ "starttime" : "17:00:00", "destseq" : 2 }
],
"tuesday" : [
{ "starttime" : "00:00:00", "destseq" : 2 },
{ "starttime" : "09:00:00", "destseq" : 1 },
{ "starttime" : "17:00:00", "destseq" : 2 }
],
"wednesday" : [
{ "starttime" : "00:00:00", "destseq" : 2 },
{ "starttime" : "09:00:00", "destseq" : 1 },
{ "starttime" : "17:00:00", "destseq" : 2 }
],
"thursday" : [
{ "starttime" : "00:00:00", "destseq" : 2 },
{ "starttime" : "09:00:00", "destseq" : 1 },
{ "starttime" : "17:00:00", "destseq" : 2 }
],
"friday" : [
{ "starttime" : "00:00:00", "destseq" : 2 },
{ "starttime" : "09:00:00", "destseq" : 1 },
{ "starttime" : "17:00:00", "destseq" : 2 }
],
"saturday" : [
{ "starttime" : "00:00:00", "destseq" : 2 }
],
"sunday" : [
{ "starttime" : "00:00:00", "destseq" : 2 }
]
},
"holiday_like" : "sunday",
"holiday_regions" : [
"UK/England and Wales"
],
"timezone" : "Europe/London"
},
"success" : 1
}
It has been decided that voicemails have been going to the wrong mailbox so a new voicemail mailbox with mailboxID 2388
has been created with the telecoms.voicemail.mailbox.create function. It is therefore necessary to re-send the
dests argument to redefine the destinations so that the mailboxID can be updated in the dayparting.
Also, management have decided that their workers can go home earlier on Fridays, but for some inexplicable reason want to make them wait
15 seconds after 16:30 before they can clock off. As this is the only day whose time segments are being changed, you only need to redefine
friday within the calendar argument.
JSON example request:
POST https://live.apicontrol.co.uk/1/json
{
"auth" : {
"username" : "YOURUSERNAME",
"password" : "YOURPASSWORD",
},
"func" : "telecoms.dayparting.edit",
"args" : {
"daypartingID" : 2850
"dests" : [
{ "destseq" : 1, "dest_type" : "ddi", "ddi" : "01276500500" },
{ "destseq" : 2, "dest_type" : "voicemail", "mailboxID" : 2388 }
],
"calendar" : {
"friday" : [
{ "starttime" : "00:00", "destseq" : 2 },
{ "starttime" : "09:00", "destseq" : 1 },
{ "starttime" : "16:30:15", "destseq" : 2 }
]
}
},
}
There is no data to return so the API just returns a success indication:
JSON example response:
{
"results" : {},
"success" : 1
}
You can now see the latest changes incorporated within the dayparting:
JSON example request:
POST https://live.apicontrol.co.uk/1/json
{
"auth" : {
"username" : "YOURUSERNAME",
"password" : "YOURPASSWORD",
},
"func" : "telecoms.dayparting.get",
"args" : {
"daypartingID" : 2850
}
}
JSON example response:
{
"results" : {
"custID" : 16526,
"daypartingID" : 2850,
"desc" : "DP test",
"dests" : [
{ "destseq" : 1, "dest_type" : "ddi", "ddi" : "+441276500500" },
{ "destseq" : 2, "dest_type" : "voicemail", "mailboxID" : 2388 }
],
"calendar" : {
"monday" : [
{ "starttime" : "00:00:00", "destseq" : 2 },
{ "starttime" : "09:00:00", "destseq" : 1 },
{ "starttime" : "17:00:00", "destseq" : 2 }
],
"tuesday" : [
{ "starttime" : "00:00:00", "destseq" : 2 },
{ "starttime" : "09:00:00", "destseq" : 1 },
{ "starttime" : "17:00:00", "destseq" : 2 }
],
"wednesday" : [
{ "starttime" : "00:00:00", "destseq" : 2 },
{ "starttime" : "09:00:00", "destseq" : 1 },
{ "starttime" : "17:00:00", "destseq" : 2 }
],
"thursday" : [
{ "starttime" : "00:00:00", "destseq" : 2 },
{ "starttime" : "09:00:00", "destseq" : 1 },
{ "starttime" : "17:00:00", "destseq" : 2 }
],
"friday" : [
{ "starttime" : "00:00:00", "destseq" : 2 },
{ "starttime" : "09:00:00", "destseq" : 1 },
{ "starttime" : "16:30:15", "destseq" : 2 }
],
"saturday" : [
{ "starttime" : "00:00:00", "destseq" : 2 }
],
"sunday" : [
{ "starttime" : "00:00:00", "destseq" : 2 }
]
},
"holiday_like" : "sunday",
"holiday_regions" : [
"UK/England and Wales"
],
"timezone" : "Europe/London"
},
"success" : 1
}
It later transpired that the user works in Scotland and follows Scottish public holidays, not those in England and Wales.
So now it's necessary to call telecoms.dayparting.edit to change the holiday_regions list.
See publicholiday.region.list for a list of supported regions.
JSON example request:
POST https://live.apicontrol.co.uk/1/json
{
"auth" : {
"username" : "YOURUSERNAME",
"password" : "YOURPASSWORD",
},
"func" : "telecoms.dayparting.edit",
"args" : {
"daypartingID" : 2850,
"holiday_regions" : [
"UK/Scotland"
]
},
}
JSON example response:
{
"results" : {},
"success" : 1
}