The Test Segmentation Rule command allows you to validate a rule against any existing list to determine the number of contacts that match the rule. .
Arguments
The Test Segmentation Rule command requires the following arguments: Command, Realm, Password, Segmentation ID or Name, and List ID.
api_web?r=myrealm&p=mypass&c=testseg&segmentation_id=2&list_id=5
The command is ‘testseg', the realm is ‘myrealm’ and the password is ‘mypass’. The rule with id '2' will be validated against the list with id '5'.
The command counts and returns the number of contacts in the list that match the query.
The Test Segmentation Rule command supports the following arguments:
Name |
Req? |
Description |
Argument |
Command |
Yes |
Defines the command to use. |
cmd=testseg c=testseg |
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] r=[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] p=[password] |
Segmentation Rule |
Yes |
Identifier of the Segmentation Rule to update. Use either the rule Name or ID. |
segmentation_id=[segmentation_id] segmentation_name=[segmentation_name] |
List ID |
Yes |
Identifier of the list to validate the rule against. List must be in designated realm. |
list_id=[list_id] |
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=testseg&segmentation_id=2&list_id=5
Successful results for one call return, where ‘3’ is the number of contacts in the list that match the segmentation rule query:
SUCCESS: 3
Results
The Test Segmentation Rule command outputs either a SUCCESS or FAILURE message.
SUCCESS
The Test Segmentation Rule command success message returns the SUCCESS message and the number of contacts found. The result format is:
SUCCESS: [subscriber_count]
FAILURE
A Test Segmentation Rule command will fail for several reasons, such as if the rule does not exist. The result format is:
FAILURE: [Reason]