Segment now includes a new RuleGroups
member, instead of a Rules
member.
So for example, when you previously would have created a segment like so:
php $result = $wrap->create('Segments List ID', array( 'Title' => 'Segment Title', 'Rules' => array( array( 'Subject' => 'EmailAddress', 'Clauses' => array( 'CONTAINS example.com' ) ) , array( 'Subject' => '[customfield]', 'Clauses' => array( 'PROVIDED', 'EQUALS 1' ) ) ) ));
You would now do this:
```php $result = $wrap->create(‘Segments List ID’, array( ‘Title’ => ‘Segment Title’, ‘RuleGroups’ => array( array( ‘Rules’ => array( array( ‘RuleType’ => ‘EmailAddress’, ‘Clause’ => ‘CONTAINS example.com’ ) ) ) , array( ‘Rules’ => array( array( ‘RuleType’ => ‘[customfield]’, ‘Clause’ => ‘PROVIDED’ ) , array( ‘RuleType’ => ‘[customfield]’, ‘Clause’ => ‘EQUALS 1’ ) ) ) ) ));
The Add Rule call is now Add Rule Group, taking a ruleGroup
argument instead of a rule
argument.
function CS_REST_Segments->add_rulegroup($rulegroup)
So for example, when you previously would have added a rule like so:
$wrap = new CS_REST_Segments('Segment ID', $auth);
$result = $wrap->add_rule(array(
'Subject' => 'EmailAddress',
'Clauses' => array('CONTAINS example.com')
));
You would now do this:
$wrap = new CS_REST_Segments('Segment ID', $auth);
$result = $wrap->add_rulegroup(array(
'Rules' => array(
array(
'RuleType' => 'EmailAddress',
'Clause' => 'CONTAINS example.com'
)
)
));
CURLOPT_CAINFO
option if not already set globally via the ini system.This introduces some changes to how you authenticate using this library. You now authenticate by passing an $auth
array as the first argument when creating instances of any classes which inherit from the CS_REST_Wrapper_Base
class.
So in existing code, when you previously would have authenticated using an API key as follows:
$wrap = new CS_REST_General('Your API Key');
$result = $wrap->get_clients();
If you want to authenticate using an API key, you should now do this:
$wrap = new CS_REST_General(array('api_key' => 'Your API Key'));
$result = $wrap->get_clients();