attachRuleTemplateToLinks

Request Method: PUT

Description: Attach a Rule Template to the specified link(s). Any Rule Template found in the "Calling Rule Templates" section of the portal can be applied to a link

URL: https://api.iovox.com:444/Links?v=3&method=attachRuleTemplateToLinks

The following parameters can be sent in the querystring

ParameterDescriptionDefault ValueData TypeMandatory
vAPI version to use
INTEGERYES

Payload

The following XML payload must be sent with an attachRuleTemplateToLinks request:

<?xml version="1.0" encoding="utf-8"?>
<request>
    <template_name>Call Whisper Both</template_name>
     <overwrite_existing>TRUE</overwrite_existing>
     <link_ids>
         <link_id>100</link_id>
         <link_id>130</link_id>
         <link_id>200</link_id>
     </link_ids>
    <!-- any For more information how to get the rules_variables go to getVariableRulesOfTemplate API method -->
     <rules_variable>
             <rule>
                 <rule_id>1</rule_id>
                 <rule_type>play</rule_type>
                 <rule_label>Welcome</rule_label>
                 <sound_files>
                     <sound_file>Sound Group 1|whisper caller</sound_file>
                 </sound_files>
             </rule>
             <rule>
                 <rule_id>2</rule_id>
                 <rule_type>messageKeypress</rule_type>
                 <rule_label>Options</rule_label>
                 <play>
                     <sound_files>
                         <sound_file>Sound Group 1|whisper called</sound_file>
                         <sound_file>Sound Group 2|whisper caller</sound_file>
                     </sound_files>
                 </play>
             </rule>
             <rule>
                <rule_id>3</rule_id>
                <rule_type>call</rule_type>
                <rule_label>Call</rule_label>
                <contact>
                     <contact_id>1</contact_id>
                     <phone_number>4420754545454</phone_number>
                </contact>
                <send_call_alert>ALL_CALLS</send_call_alert>
                <record_call>TRUE</record_call>
             </rule>
     </rules_variable>
 </request>

Payload Description

ParameterDescriptionDefault ValueData TypeMandatory
template_nameThe name of the Rule Template to attach
STRINGYES
overwrite_existingTRUE/FALSE. If set to TRUE and the Link already has a Template attached then that Template will be overwritten. If set to FALSE and the Link already has a Template attached, an error will be thrown
STRINGYES
link_ids > link_idThe Link ID of the Link to attach the Rule Template to

YES
rules_variable > rule > rule_idID of the Rule to attach
INTYES
rules_variable > rule > rule_typeType of the Rule to attach
STRINGYES
rules_variable > rule > rule_labelLabel of the Rule to attach
STRINGYES
rules_variable > rule > send_call_alert

NONE – don’t send an alert

MISSED_CALLS – send an email for missed calls

MISSED_CALLS_NO_WITHHELD – send email alerts for missed calls but only when the call origin is not withheld

ALL_CALLS – send an email alert for all received calls regardless of result


STRINGNO
rules_variable > rule > record_callTRUE/FALSE. If set to TRUE, the call will be recorded. If set to FALSE, the call will not be recorded
STRINGNO

Rule Specific Payload Description

The following is dependent on the Rule Template being applied. Rules with custom fields will require one of more items from the payload below

ParameterDescriptionDefault ValueData TypeMandatory For
pre_whisper_callerA Pre Call Whisper to the Caller
XMLN/A
pre_whisper_calledA Pre Call Whisper to the Called party
XMLN/A
labelWhen inside pre_whisper_caller or pre_whisper_called, the Label of the Whisper to use
STRINGpre_whisper_caller, pre_whisper_called
callInitiate a Direct Call to the specified Contact
XMLN/A
rule > contact > contact_idThe Contact ID to call
STRINGcall
rule > contact > phone_numberThe Phone Number to call. This must belong to the contact_id specified
INTEGERcall

Result

Error Result

HTTP CodeError StringResolution
400API Version EmptyAdd a value for the v parameter in the query string
400API Version InvalidCorrect v parameter
400Overwrite Existing EmptyAdd overwrite_existing to the query string
400Overwrite Existing InvalidCorrect overwrite_existing to be TRUE or FALSE
400Request Method must be PUT. x attemptedSwitch request method x to PUT
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
400Template Name EmptyAdd Template Name
400Template Name does not existCorrect Template Name
400Link IDs EmptyAdd one or more link_ids to the request
400Link ID x of y EmptyAdd Link ID to Rule Detail x of y
400Link ID x of y does not existCorrect link_id x (current) of y (total)
400Link IDs already have rules attached: x,y,zRemove Link IDs x, y and z from the XML or set overwrite_existing to TRUE
400Duplicate Link ID ReceivedRemove duplicates from Link ID lis
400Rule Detail x of y (Whisper Label) EmptyAdd Whisper Label to Rule Detail x of y
400Rule Detail x of y (Whisper Label) does not existCorrect Whisper Label In Rule Detail x of y
400Rule Detail x of y (Contact ID) EmptyAdd Contact ID to Rule Detail x of y
400Rule Detail x of y (Contact ID) does not existCorrect Contact ID in Rule Detail x of y
400Rule Detail x of y (Phone Number) EmptyAdd Phone Number to Rule Detail x of y
400Rule Detail x of y (Phone Number) does not belong to contact zCorrect Phone Number in Rule Detail x of y to match a phone number from Contact ID z
400Rule Detail x of y (Phone Number) not an is not internationalisedCorrect Phone Number in Rule Detail x of y so it is in an internationalised format
400Rule Details Empty.Add rule details.
400Multiple matches for Sound Label (x) Sound Group: (y,z)Specify the sound group (y,z) for this sound label (x)
400Phone Number not an integerCorrect Phone number
400Send Call Alert x of y invalidCorrect Call alert field
400Record call x of y invalidCorrect Record call field
500Internal Server ErrorRetry later

Success Result

HTTP/1.1 204 No Content