https://<subdomain>.sendsmaily.net/api/list.php


POST method must be used for this query.


Parameters

All parameters must be URL encoded.


Parameter

Value

id

ID of the filter, if editing.

name

Name of filter. Required.

filter_type

Parameter to specify the inclusion of conditions. Possible values: ALL - subscriber data must conform to all the segmentation rules, specified with filter_data and ANY - subscriber data must conform with at least one of the specified segmentation rules. Required.

filter_data

Segmentation rules. Required.


Structure of segmentation rules
[data field, [calculation, value]]
Example: ["email", ["EndsWith", "@smaily.com"]]

Possible calculations - Equal, NotEqual, BeginsWith, Contains, DoesNotContain, EndsWith, LessThan, LessThanEqual, GreaterThanEqual, GreaterThan

Example queries:

Create a filter

   

$username = 'YOUR_USERNAME';
$password = 'YOUR_PASSWORD';
$location = 'https://<subdomain>.sendsmaily.net/api/list.php';
$data = array(
  'name' => 'This be the name',
  'filter_type' => 'A',
  'filter_data' => array(
    array('email', array('EndsWith', '@domain.com'))
  ),
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $location);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($query));

$result = curl_exec($ch);
curl_close($ch); 

   

Successful results of the query are for example:

 

{
  'code': 101,
  'message': 'OK',
  'id': 3,
}

 

Edit a filter

  

$username = 'YOUR_USERNAME';
$password = 'YOUR_PASSWORD';
$location = 'https://<subdomain>.sendsmaily.net/api/list.php';
$data = array(
  'id' => 3,
  'name' => 'This be the name',
  'filter_type' => 'A',
  'filter_data' => array(
    array('email', array('BeginsWith', 'info@'))
  ),
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $location);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($query));

$result = curl_exec($ch);
curl_close($ch);

 

 Successful results of the query are for example:

 

{
  'code': 101,
  'message': 'OK',
  'id': 3,
}

 

 See also other possible results from Possible results.