Create a filter selection
https://us.stannp.com/api/v1/selections/new
Creates an auto filter for a group.
Parameters
group_id | int | Mandatory. The ID of the group to associate this selection with. |
name | string | Name your filter |
filters | string |
A specially formatted string to represent your filters. eg: total_spent:::more_than:::300 The format is based on the following: [column_name]:::[string_operator]:::[value] The string operators available are: matches, contains, begins, ends, before, after, less_than, more_than, is_not. You can chain multiple filters together like this.. total_spent:::more_than:::300:::AND:::country:::matches:::GB |
Request
$ curl https://us.stannp.com/api/v1/selections/new \ -u {API_KEY}: \ -d "group_id=1" \ -d "name=update" \ -d "filters=Steve"
$curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://us.stannp.com/api/v1/selections/new?api_key={API_KEY}', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => array( 'group_id' => "1", 'name' => "update", 'filters' => "Steve" ), )); $response = curl_exec($curl); curl_close($curl); print_r($response);
import requests data = { 'group_id': '1', 'name': 'update', 'filters': 'Steve' } response = requests.post('https://us.stannp.com/api/v1/selections/new?api_key={API_KEY}', data=data) print(response.text)
var client = new RestClient("https://us.stannp.com/api/v1/selections/new?api_key={API_KEY}"); var request = new RestRequest(Method.POST); request.AddParameter("group_id", "1"); request.AddParameter("name", "update"); request.AddParameter("filters", "Steve"); IRestResponse response = client.Execute(request); Console.WriteLine(response.Content)Return
{ "success":true, "data":[{ "id":"1234" }] }