createTimeTemplates¶
Request Method: POST
Description: Create a Time Template(s)
URL: https://api.iovox.com:444/Rules?v=3&method=createTimeTemplates
The following parameters must be sent in the querystring:
Parameter | Description | Default Value | Data Type | Mandatory |
v | API version to use | INTEGER | YES |
Payload¶
The following XML payload must be sent with an createTimeTemplates request:
<?xml version="1.0" encoding="UTF-8"?>
<request>
<time_template><!-- Every Monday to Thursday between 9am and 6pm during all 2012 -->
<label>Working hours in 2013</label>
<time_frames>
<time_frame>
<date_from>2012-12-01</date_from>
<date_to>2012-12-31</date_to>
<recurrence>NONE</recurrence>
<time_from>09:00</time_from>
<time_to>18:00</time_to>
<days>
<day>MON</day>
<day>TUE</day>
<day>WED</day>
<day>THU</day>
</days>
</time_frame>
</time_frames>
</time_template>
<time_template><!-- Every Monday morning and Friday afternoon during January 2012 -->
<label>Template 2</label>
<time_frames>
<time_frame>
<date_from>2012-01-01</date_from>
<date_to>2012-01-31</date_to>
<recurrence>NONE</recurrence>
<time_from>09:00</time_from>
<time_to>12:00</time_to>
<days>
<day>MON</day>
</days>
</time_frame>
<time_frame>
<date_from>2012-01-01</date_from>
<date_to>2012-01-31</date_to>
<recurrence>NONE</recurrence>
<request>
<time_template><!-- Every Monday to Thursday between 9am and 6pm during all 2012 -->
<label>Working hours in 2012</label>
<time_frames>
<time_frame>
<date_from>2012-01-01</date_from>
<date_to>2012-12-31</date_to>
<recurrence>NONE</recurrence>
<time_from>09:00</time_from>
<time_to>18:00</time_to>
<days>
<day>MON</day>
<day>TUE</day>
<day>WED</day>
<day>THU</day>
</days>
</time_frame>
</time_frames>
</time_template>
<time_template><!-- Every Monday morning and Friday afternoon during January 2012 -->
<label>Template 2</label>
<time_frames>
<time_frame>
<date_from>2012-01-01</date_from>
<date_to>2012-01-31</date_to>
<recurrence>NONE</recurrence>
<time_from>09:00</time_from>
<time_to>12:00</time_to>
<days>
<day>MON</day>
</days>
</time_frame>
<time_frame>
<date_from>2012-01-01</date_from>
<date_to>2012-01-31</date_to>
<recurrence>NONE</recurrence>
<time_from>12:00</time_from>
<time_to>18:00</time_to>
<days>
<day>FRI</day>
</days>
</time_frame>
</time_frames>
</time_template>
<time_template><!-- Every 1st of each month (Any day of the week) -->
<label>Template 3</label>
<time_frames>
<time_frame>
<date_from>2012-01-01</date_from>
<date_to>2012-01-01</date_to>
<recurrence>MONTHLY</recurrence>
<days>
<day>MON</day>
<day>TUE</day>
<day>WED</day>
<day>THU</day>
<day>FRI</day>
<day>SAT</day>
<day>SUN</day>
</days>
</time_frame>
</time_frames>
</time_template>
<time_template><!-- Christmas day every year -->
<label>Template 4</label>
<time_frames>
<time_frame>
<date_from>2012-12-25</date_from>
<date_to>2012-12-25</date_to>
<recurrence>YEARLY</recurrence>
<days>
<day>MON</day>
<day>TUE</day>
<day>WED</day>
<day>THU</day>
<day>FRI</day>
<day>SAT</day>
<day>SUN</day>
</days>
</time_frame>
</time_frames>
</time_template>
</request>ce>
<time_from>12:00</time_from>
<time_to>18:00</time_to>
<days>
<day>FRI</day>
</days>
</time_frame>
</time_frames>
</time_template>
<time_template><!-- Every 1st of each month (Any day of the week) -->
<label>Template 3</label>
<time_frames>
<time_frame>
<date_from>2012-01-01</date_from>
<date_to>2012-01-01</date_to>
<recurrence>MONTHLY</recurrence>
<days>
<day>MON</day>
<day>TUE</day>
<day>WED</day>
<day>THU</day>
<day>FRI</day>
<day>SAT</day>
<day>SUN</day>
</days>
</time_frame>
</time_frames>
</time_template>
<time_template><!-- Christmas day every year -->
<label>Template 4</label>
<time_frames>
<time_frame>
<date_from>2012-12-25</date_from>
<date_to>2012-12-25</date_to>
<recurrence>YEARLY</recurrence>
<days>
<day>MON</day>
<day>TUE</day>
<day>WED</day>
<day>THU</day>
<day>FRI</day>
<day>SAT</day>
<day>SUN</day>
</days>
</time_frame>
</time_frames>
</time_template>
</request>
Payload Description:¶
The following parameters can be sent in the querystring
Node Name | Description | Default Value | Data Type | Mandatory |
label | Label of the Time Template | STRING | YES | |
time_frame | Contain informations about the frame of time | XML | YES | |
time_frame > date_from | Start date of the time frame,format YYYY-MM-DD. Can be empty to apply this time frame starting immediately | DATE | NO | |
time_frame > date_to | End date of the time frame,format YYYY-MM-DD. Can be empty to apply this time frame forever | DATE | NO | |
time_frame > recurrence | Set the frequency mode of this time frame, can be one of theses values YEARLY : repeat this frame every year, this will ignore the year value in dates MONTHLY : repeat this frame every months, this will ignore the month value in dates NONE : Apply the frame from date_from to date_to | NONE | STRING | NO |
time_frame > time_from | Daily start time of the time frame,format HH:MM | 00:00 | TIME | NO |
time_frame > time_to | Daily end time of the time frame,format HH:MM | 23:59 | TIME | NO |
time_frame > days > day | Define days where this template is applied. Insert all days to select all the week, or choose a subset of these. Format is 3 character string of week days (e.g MON, TUE or WED) | STRING | YES |
Result¶
Error Result¶
HTTP Code | Error String | Resolution |
400 | API Version Empty | Add a value for the v parameter in the query string |
400 | API Version Invalid | Correct v parameter |
400 | Request Method must be POST. x attempted | Switch request method x to POST |
400 | XML Empty | Add xml to the request body |
400 | XML parse error. x at line y, column z | Correct XML at point x on line y, column z |
400 | Request Empty | Add at least one node to the request |
400 | label X already exists | Correct the label X to a new one, or use the update method |
400 | Time Template Label X invalid | Correct the label X |
400 | Time frames empty | There is not any time frame, a template cannot be empty |
400 | Recurrence invalid | Correct the recurrence parameter, it can only be YEARLY : repeat this frame every year, so don't care about the year value in dates MONTHLY : repeat this frame every months, so don't care about the month value in dates NONE : Apply the frame from date_from to date_to |
400 | date_from invalid | Correct date to match the format YYYY-MM-DD |
400 | date_to invalid | Correct date to match the format YYYY-MM-DD |
400 | The start date is after the end date | Correct date_from or date_to |
400 | date_from and date_to must both be empty or both have a value | An empty date_from and date_to means this frame doesn't have a range, then both must be empty. To select a range of time, full date_from and date_to. |
400 | time_from invalid | Correct time to match the format HH:MM (must be between 00:00 and 23:59) |
400 | time_to invalid | Correct time to match the format HH:MM (must be between 00:00 and 23:59) |
400 | X is not a valid day | Correct the value to be a valid day (only MON,TUE,WED,THU,FRI,SAT or SUN) |
400 | Days Empty | Select days by adding "day" elements |
400 | Time Frame X is too general | The time frame you entered select all the time, it must only select a period of time. To create a blocking rule applied all the time, you must not assign it to a template |
500 | Internal Server Error | Retry later |