segmentCreate
public static string segmentCreate(string token, array segmentDetail)
Create a new List Segment based on the details provided. Return the ID of the newly created List Segment.
| Parameters |
| string token | A valid token for your account. To generate a token, use the login method. |
| array segmentDetail | The array containing the segment details.
| string segmentName | Name of the segment | | string description | Description for your segment | | string listid | The ID of the contact list on which the segment is to be created |
|
| Returns |
| string | Returns the ID of the newly created list segment. |
- <?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 contact list ID, so we can retrieve the target contact list ID.
- **/
- $contactList = $client->listGet($token, "", 1, 1, "", "");
- $listID = $contactList[0]['id'];
-
- $segmentDetail['segmentName'] = 'Segment 1';
- $segmentDetail['description'] = 'Test Segment';
- $segmentDetail['listid'] = $listID;
- $segmentID = $client->segmentCreate($token, $segmentDetail);
- ?>