public static string segmentCreateCriteria(string token, string segmentID, array segmentCriteriaDetail)
Create a new Criteria for a Segment based on the details provided. Return the ID of the newly created Segment Criteria.
Contact List Related Methods

string tokenA valid token for your account. To generate a token, use the login method.
string segmentIDThe ID of the segment in which the criteria is to be created. To fetch the segments, use the segmentGet method.
array segmentCriteriaThe array containing the segment details.
string fieldThe field for the filter. (in case the field is not "Subscribed Date")
string filterTypeThe type of filter (starts, ends, contains, equal, not starts, not ends, not contains, not equal, between)
string filterThe filter text to match (in case the field is not "Subscribed Date")
string startDateThe date on the filter is to start in case the field is "Subscribed Date"
string endDateThe date on the filter is to end in case the field is "Subscribed Date" and the filterType is "between"
string fieldTypeThe field type (0 for default or 4 for data field having date value)

stringReturns the ID of the newly created segment criteria.

download example code

  1. <?php
  2. /**
  3. This Example shows how to authenticate a user using XML-RPC.
  4. Note that we are using the PEAR XML-RPC client and recommend others do as well.
  5. **/
  6. require_once 'XML/RPC2/Client.php';
  7. require_once 'inc/config.php';
  8. $client = XML_RPC2_Client::create($apiURL);
  9. $token = $client->login($apiLogin, $apiPassword);
  11. /**
  12. Fetch the latest segment ID, so we can retrieve the target segment ID.
  13. **/
  14. $segmentLists = $client->segmentGet($token, "", 1, 1, "" );
  15. $segmentID = $segmentLists[0]['id'];
  17. $segmentCriteriaDetail['field'] = 'Email';
  18. $segmentCriteriaDetail['filterType'] = 'starts';
  19. $segmentCriteriaDetail['filter'] = 'mar';
  20. $segmentCriteriaDetail['startDate'] = '';
  21. $segmentCriteriaDetail['endDate'] = '';
  22. $segmentCriteriaDetail['fieldType'] = '0';
  23. $segmentCriteriaID = $client->segmentCreateCriteria($token, $segmentID, $segmentCriteriaDetail);
  24. ?>