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:

ParameterDescriptionDefault ValueData TypeMandatory
vAPI version to use
INTEGERYES

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 NameDescriptionDefault ValueData TypeMandatory
labelLabel of the Time Template
STRINGYES
time_frameContain informations about the frame of time
XMLYES
time_frame > date_fromStart date of the time frame,format YYYY-MM-DD. Can be empty to apply this time frame starting immediately
DATENO
time_frame > date_toEnd date of the time frame,format YYYY-MM-DD. Can be empty to apply this time frame forever
DATENO
time_frame > recurrenceSet 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
NONESTRINGNO
time_frame > time_fromDaily start time of the time frame,format HH:MM00:00TIMENO
time_frame > time_toDaily end time of the time frame,format HH:MM23:59TIMENO
time_frame > days > dayDefine 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)
STRINGYES

Result

Error Result

HTTP CodeError StringResolution
400API Version EmptyAdd a value for the v parameter in the query string
400API Version InvalidCorrect v parameter
400Request Method must be POST. x attemptedSwitch request method x to POST
400XML EmptyAdd xml to the request body
400XML parse error. x at line y, column zCorrect XML at point x on line y, column z
400Request EmptyAdd at least one node to the request
400label X already existsCorrect the label X to a new one, or use the update method
400Time Template Label X invalidCorrect the label X
400Time frames emptyThere is not any time frame, a template cannot be empty
400Recurrence invalidCorrect 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
400date_from invalidCorrect date to match the format YYYY-MM-DD
400date_to invalidCorrect date to match the format YYYY-MM-DD
400The start date is after the end dateCorrect date_from or date_to
400date_from and date_to must both be empty or both have a valueAn 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.
400time_from invalidCorrect time to match the format HH:MM (must be between 00:00 and 23:59)
400time_to invalidCorrect time to match the format HH:MM (must be between 00:00 and 23:59)
400X is not a valid dayCorrect the value to be a valid day (only MON,TUE,WED,THU,FRI,SAT or SUN)
400Days EmptySelect days by adding "day" elements
400Time Frame X is too generalThe 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
500Internal Server ErrorRetry later

Success Result

HTTP/1.1 201 Created