segmentCreateCriteria
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.
| Parameters |
| string token | A valid token for your account. To generate a token, use the login method. |
| string segmentID | The ID of the segment in which the criteria is to be created. To fetch the segments, use the segmentGet method. |
| array segmentCriteria | The array containing the segment details.
| string field | The field for the filter. (in case the field is not "Subscribed Date") | | string filterType | The type of filter (starts, ends, contains, equal, not starts, not ends, not contains, not equal, between) | | string filter | The filter text to match (in case the field is not "Subscribed Date") | | string startDate | The date on the filter is to start in case the field is "Subscribed Date" | | string endDate | The date on the filter is to end in case the field is "Subscribed Date" and the filterType is "between" |
|
| Returns |
| string | Returns the ID of the newly created segment criteria. |
- <?php
- /**
- This Example shows how to authenticate a user using XML-RPC.
- Note that we are using the PEAR XML-RPC client and recommend others do as well.
- **/
- require_once 'XML/RPC2/Client.php';
- require_once 'inc/config.php';
- $client = XML_RPC2_Client::create($apiURL);
- $token = $client->login($apiLogin, $apiPassword);
-
- /**
- Fetch the latest segment ID, so we can retrieve the target segment ID.
- **/
- $segmentLists = $client->segmentGet($token, "", 1, 1, "" );
- $segmentID = $segmentLists[0]['id'];
-
- $segmentCriteriaDetail['field'] = 'Email';
- $segmentCriteriaDetail['filterType'] = 'starts';
- $segmentCriteriaDetail['filter'] = 'mar';
- $segmentCriteriaDetail['startDate'] = '';
- $segmentCriteriaDetail['endDate'] = '';
- $segmentCriteriaID = $client->segmentCreateCriteria($token, $segmentID, $segmentCriteriaDetail);
- ?>