listSegments()

List of all segments is obtained.

listSegments(string $id) : struct
Input parameters
  • id - list ID that the segment is based on

Information obtained

Array of segments. Each segment is represented as an array that includes:

  • id - segment ID that is used in other API functions
  • web_id - segment ID that is used in the administration page. This value is also used when creating a new SMS campaign.
  • name - name of segment
  • date_created - date of segment creation
  • member_count - number of emails in segment

Examples

mgapi_listSegments.php
listSegments($id);
 
header("Content-Type: text/plain");
if ($api->errorCode) {
    echo "Unable to load listSegments()!";
    echo "\tCode=" . $api->errorCode . "\n";
    echo "\tMsg=" . $api->errorMessage . "\n";
} else {
    echo "List Segments returned: " . sizeof($retval) . "\n";
    foreach ($retval as $segment) {
        echo "Id = " . $segment['id'] . " - " . $segment['name'] . "\n";
    }
}

© 2010-2017 Mailigen. All rights reserved.