listSegmentCreate()

New segment is created for a given single list. You may add multiple rules to filter out contacts in your list by merge field values. Provide match type to match all or any of given rules.

listSegmentCreate(string $list, string $title, string $match, array $filter) : string
Input parameters
  • list - list ID that the segment will be based on
  • title - name of the segment
  • match - match type (AND, OR) to be used when chaining together multiple filter rules
  • filter - list (array) of rules to filter out contacts. Every rule is an array consisting of:
    • field - merge field tag
    • condition - condition name (is, not, isany, isoneof, notoneof, contains, notcontain, starts, ends, greater, less)
    • value - value that will be used for filtering.
You may enter multiple values separated by semicolon ";" when using condition isoneof or notoneof.

Information obtained
  • ID of the new segment

Examples

mgapi_listSegmentCreate.php
 'merge0',
        'condition' => 'ends', //is, not, isany, contains, notcontain, starts, ends, greater, less
        'value' => '@gmail.com',
    ),
    //...
    array(
        'field' => 'confirm_time',
        'condition' => 'greater',
        'value' => '2013-01-01',
    ),
);
 
$retval = $api->listSegmentCreate($list, $title, $match, $filter);
 
header("Content-Type: text/plain");
if ($api->errorCode) {
    echo "Unable to load listSegmentCreate()!\n";
    echo "\tCode=" . $api->errorCode . "\n";
    echo "\tMsg=" . $api->errorMessage . "\n";
} else {
    echo "New Segment ID:" . $retval . "\n";
}

© 2010-2017 Mailigen. All rights reserved.