function telecoms.dayparting.get

See also:

Used to fetch an existing dayparting.

Arguments:

argrequired?syntaxinfo
daypartingIDYposintIdentifies the dayparting you wish to edit
custIDNposintcustID of the account that owns the dayparting being fetched (defaults to the current account). You only need to specify this if you are fetching a dayparting in a sub-account.

Further argument information

daypartingID

The daypartingID argument identifies which dayparting you wish to fetch. This will be the daypartingID value returned by telecoms.dayparting.create when the dayparting was created. It is also returned by telecoms.dayparting.list.

Example 1

Fetching the dayparting with daypartingID 2850.

telecoms.dayparting.get returns the dayparting definition within the "results" sub-object.

The format of the results sub-object exactly matches the arguments you can send back in to telecoms.dayparting.edit to edit the day parting (though you would probably want to change some of the detail first else the action wouldn't actually result in anything being changed).

The results sub-object is also the same as the arguments you would send to telecoms.dayparting.create in order to create an identical dayparting, though you would need to ensure that you don't send the daypartingID argument.

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
}

Here you can see that within the calendar, on Monday for example then from 00:00:00 calls will be routed to the destination defined within dests with the destseq value of 2 which, in this example, is voicemail with mailboxID 1649.

From 09:00:00 callers will be routed to the destination defined in destswith the destseq value of 1 which in this example, is going to UK phone number 01276500500.

Finally, from 17:00:00 until the end of the day (23:59:59), callers will be direced back to voicemail again.

After 23:59:59 on Monday, we're into Tuesday so you need to look within the tuesday segments to see where calls will then be delivered.

timezone is set to Europe/London which is UK local time, so the calendar segments will correspond to the UK local time.

holiday_regions contains UK/England and Wales and holiday_like is set to sunday, so on days that are public holidays in UK/England and Wales, calls will be routed as if it were Sunday.

Example 2

Fetching a dayparting which was created without holiday_like or holiday_regions set, and has some inactive time segments in the calendar:

JSON example request:

POST https://live.apicontrol.co.uk/1/json
{
    "auth" : {
        "username" : "YOURUSERNAME",
        "password" : "YOURPASSWORD",
    },
   "func" : "telecoms.dayparting.get",
   "args" : {
      "daypartingID" : 2842
   }
}

JSON example response:

{
   "results" : {
      "custID" : 16526,
      "daypartingID" : 2842,
      "desc" : "Saltaire Brewery",
      "dests" : [
         { "destseq" : 1, "dest_type" : "ddi", "ddi" : "+441276459901" }
      ],
      "calendar" : {
         "monday" : [
            { "starttime" : "00:00:00", "destseq" : null },
            { "starttime" : "09:00:00", "destseq" : 1 },
            { "starttime" : "13:00:00", "destseq" : null },
         ],
         "tuesday" : [
            { "starttime" : "00:00:00", "destseq" : null },
            { "starttime" : "09:00:00", "destseq" : 1 },
            { "starttime" : "13:00:00", "destseq" : null },
         ],
         "wednesday" : [
            { "starttime" : "00:00:00", "destseq" : null },
            { "starttime" : "09:00:00", "destseq" : 1 },
            { "starttime" : "13:00:00", "destseq" : null },
         ],
         "thursday" : [
            { "starttime" : "00:00:00", "destseq" : null },
            { "starttime" : "09:00:00", "destseq" : 1 },
            { "starttime" : "13:00:00", "destseq" : null },
         ],
         "friday" : [
            { "starttime" : "00:00:00", "destseq" : null },
            { "starttime" : "09:00:00", "destseq" : 1 },
            { "starttime" : "13:00:00", "destseq" : null },
         ],
         "saturday" : [
            { "starttime" : "00:00:00", "destseq" : null },
         ],
         "sunday" : [
            { "starttime" : "00:00:00", "destseq" : null },
         ]
      },
      "holiday_like" : null,
      "holiday_regions" : [],
      "timezone" : "Europe/London"
   },
   "success" : 1
}

In calendar you can see a number of time segments where destseq is null. When this is done, callers will be presented with a busy/engaged tone if calling during one of these times.

Because holiday_like and holiday_regions were not set when the dayparting was created, there is no special behaviour on public holidays. These fields are shown as null and [] (ie an empty list) respectively.