The Update Segmentation Rule command allows you to make changes to an existing Advanced Segmentation Rule. The command requires the following arguments: Command, Realm, Password, Segmentation Type, Segmentation ID, Segmentation Name, Rule(s), and List ID.
api_web?r=myrealm&p=mypass&c=updateseg&segmentation_type=adv&segmentation_id=2&segmentation_name=my+advanced+rule&list_id=5&rules=email%20=%20'jane@domain.com'%20OR%20email%20=%20'jayne@domain.com'
The command is ‘updateseg', the realm is ‘myrealm’ and the password is ‘mypass’. The rule with id '2' and named ‘my advanced rule’ and will be updated to search the list for contact with email address 'jane@domain.com' or 'jayne@domain.com'.
The command updates an existing advanced segmentation rule and returns the segmentation rule id. The list_id is required in order to determine if the rule is valid. You may use any list in your realm. You can change the name, list, or rules. The type cannot be changed.
You can define any size query in the advance segmentation rule. To add multiple rules, define each rule separated by either ‘AND’ or ‘OR’. The ‘rules’ argument must include the field name, comparison operator, and value. The field name can be any default contact data field or custom data field.
Example
Using all commands and arguments (please note the command is wrapped for display purposes only).
AND operator with two rules:
api_web?r=myrealm&p=mypass&c=updateseg&segmentation_id=2&segmentation_type=adv&list_id=5&segmentation_name=my+advanced+rule1&description=Advanced+rule+1+update&rules=email='jane@domain.com'%20and%20first_name%20not+endswith%20'y'
No operator with one rule:
api_web?r=myrealm&p=mypass&c=updateseg&segmentation_id=3&segmentation_type=adv&list_id=5&segmentation_name=my+advanced+rule2&description=Advanced+rule+2+update&rules=last_sent_date%20>%20'2007-10-22'
Combination of operators and grouped rules:
api_web?r=myrealm&p=mypass&c=updateseg&segmentation_id=10&segmentation_type=adv&list_id=5&segmentation_name=my+advanced+rule3&description=Advanced+rule+3+update&rules=(last_sent_date%20>%20'2007-10-22'%20or%20 last_sent_date%20not+exists)%20and%20('jane@domain.com'%20and%20 first_name%20not+endswith%20'y'%20and%20last_name%20contains%20'doe')
Successful results for one call return, where ‘10’ is the ID of the updated rule:
SUCCESS: 10
Results
The Update Segmentation Rule command outputs either a SUCCESS or FAILURE message.
SUCCESS
The Update Segmentation Rule command success message returns the SUCCESS message and the id of the updated rule. The result format is:
SUCCESS: [segmentation_rule_id]
FAILURE
A Update Segmentation Rule command will fail for several reasons, such as if the rule does not exist. The result format is:
FAILURE: [Reason]
Arguments
The Update Segmentation Rule command supports the following arguments:
Name |
Req? |
Description |
Argument |
Command |
Yes |
Defines the command to use. |
cmd=updateseg |
Realm |
Yes |
Name of the realm to run the command. This is required, and the command will fail if the realm and password do not match. |
realm=[realm_name] |
Password |
Yes |
Authentication code for API access. This is required, and the command will fail if the realm and password do not match. |
pwd=[password] |
Segmentation Rule ID |
Yes |
Identifier of the Segmentation Rule to update. |
segmentation_id=[segmentation_id] |
Segmentation Rule Name |
Yes |
Name of the advanced segmentation rule to update. To include spaces in the name, replace space with '+' or '%20' to avoid possible issues with spaces in a URL. |
segmentation_name=[segmentation_name] |
Segmentation Type |
Yes |
Specifies the type of segmentation rule to update. Define as type 'adv' for advanced. |
segmentation_type=adv |
List ID |
Yes |
Identifier of the list to validate the rule against. List must be in designated realm. |
list_id=[list_id] |
Segmentation Rules |
Yes |
Define the query to evaluate. |
rules=[query] |
Description |
|
Short text description of the Segmentation Rule. |
description=[text] |
Folder |
Identifier of the Folder to associate the Rule for organization. Default folder is 0, or Unfiled. |
folder_id=[folder_id] |