List groups
https://dash.stannp.com/api/v1/groups/list
You can use the offset
and limit
parameters for pagination as seen in the example request.
Request
$ curl https://dash.stannp.com/api/v1/groups/list \ -u {API_KEY}:
define("API_KEY", "YOUR API KEY"); $opts = array( 'http' => array( 'method' => 'GET', 'header' => 'Content-type: application/x-www-form-urlencoded' ) ); $context = stream_context_create($opts); $result = file_get_contents("https://dash.stannp.com/api/v1/groups/list?api_key=" . API_KEY, false, $context); $response = json_decode($result, true); print_r($response);
import requests response = requests.get('https://dash.stannp.com/api/v1/groups/list?api_key={API_KEY}') print(response.text)
var client = new RestClient("https://dash.stannp.com/api/v1/groups/list?api_key={API_KEY}"); var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); Console.WriteLine(response.Content);Return
{ "success":true, "data":[ { "id":"398", "account_id":"1", "name":"Test Group", "created":"2015-09-25 11:57:35", "recipients":"100", "valid":"98", "international":"0", "skipped":"0", "status":"ready", "import_progress":"0", "is_seeds":"0" }, { "id":"390", "account_id":"1", "name":"My Data", "created":"2015-09-23 10:50:48", "recipients":"6000", "valid":"5872", "international":"0", "skipped":"0", "status":"ready", "import_progress":"0", "is_seeds":"0" } ] }
Create a new group
https://dash.stannp.com/api/v1/groups/new
Parameters
name | string [required] | Name of the new group to be created. |
Request
$ curl https://dash.stannp.com/api/v1/groups/new \ -u {API_KEY}: \ -d "name=My Group"
$curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://dash.stannp.com/api/v1/groups/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( 'name' => "My Group" ), )); $response = curl_exec($curl); curl_close($curl); print_r($response);
import requests data = { 'name': 'My Group' } response = requests.post('https://dash.stannp.com/api/v1/groups/new?api_key={API_KEY}', data=data) print(response.text)
var client = new RestClient("https://dash.stannp.com/api/v1/groups/new?api_key={API_KEY}"); var request = new RestRequest(Method.POST); request.AddParameter("name", "My Group"); IRestResponse response = client.Execute(request); Console.WriteLine(response.Content)Response
{ "success":true, "data":"39" }
Add recipients to a group
https://dash.stannp.com/api/v1/groups/add/:group_id
Parameters
recipients | string [required] | Comma separated recipient id's. |
Request
$ curl https://dash.stannp.com/api/v1/groups/add/1234 \ -u {API_KEY}: \ -d "recipients=45112,45113"
$curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://dash.stannp.com/api/v1/groups/add/1234?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( 'recipients' => "45112,45113" ), )); $response = curl_exec($curl); curl_close($curl); print_r($response);
import requests data = { 'recipients': '45112,45113' } response = requests.post('https://dash.stannp.com/api/v1/groups/add/1234?api_key={API_KEY}', data=data) print(response.text)
var client = new RestClient("https://dash.stannp.com/api/v1/groups/add/1234?api_key={API_KEY}"); var request = new RestRequest(Method.POST); request.AddParameter("recipients", "45112,45113"); IRestResponse response = client.Execute(request); Console.WriteLine(response.Content)Response
{ "success":true, "data":true }
Remove recipients from a group
Note this only removes the recipient from the group and will not completely delete the recipient. You must use the recipients endpoint to delete the record completely.https://dash.stannp.com/api/v1/groups/remove/:group_id
Parameters
recipients | string [required] | Comma separated recipient id's. |
Request
$ curl https://dash.stannp.com/api/v1/groups/remove/1234 \ -u {API_KEY}: \ -d "recipients=45112,45113"
$curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://dash.stannp.com/api/v1/groups/remove/1234?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( 'recipients' => "45112,45113" ), )); $response = curl_exec($curl); curl_close($curl); print_r($response);
import requests data = { 'recipients': '45112,45113' } response = requests.post('https://dash.stannp.com/api/v1/groups/remove/1234?api_key={API_KEY}', data=data) print(response.text)
var client = new RestClient("https://dash.stannp.com/api/v1/groups/remove/1234?api_key={API_KEY}"); var request = new RestRequest(Method.POST); request.AddParameter("recipients", "45112,45113"); IRestResponse response = client.Execute(request); Console.WriteLine(response.Content)Response
{ "success":true, "data":true }
Purge a group
https://dash.stannp.com/api/v1/groups/purge
Parameters
id | int [required] | The id of the group to delete |
delete_recipients | bool [optional] |
True or false. Delete all recipients in this group if true. WARNING: If true this will completely delete the recipients so they will not exist in any other groups if the recipient was in multiple groups. Defaults to false. Which will not delete recipients. |
Request
$ curl https://dash.stannp.com/api/v1/groups/purge \ -u {API_KEY}: \ -d "id=123"
$curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://dash.stannp.com/api/v1/groups/purge?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( 'id' => "123" ), )); $response = curl_exec($curl); curl_close($curl); print_r($response);
import requests data = { 'id': '123' } response = requests.post('https://dash.stannp.com/api/v1/groups/purge?api_key={API_KEY}', data=data) print(response.text)
var client = new RestClient("https://dash.stannp.com/api/v1/groups/purge?api_key={API_KEY}"); var request = new RestRequest(Method.POST); request.AddParameter("id", "123"); IRestResponse response = client.Execute(request); Console.WriteLine(response.Content)Response
{ "success": true, "data": true }
Re-Calculate a group
Will recalculate a group to make sure stats are up to date.https://dash.stannp.com/api/v1/groups/calculate/[id]
Request
$ curl https://dash.stannp.com/api/v1/groups/calculate/123 \ -u {API_KEY}: \
$curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://dash.stannp.com/api/v1/groups/calculate/123?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( ), )); $response = curl_exec($curl); curl_close($curl); print_r($response);
import requests data = { } response = requests.post('https://dash.stannp.com/api/v1/groups/calculate/123?api_key={API_KEY}', data=data) print(response.text)
var client = new RestClient("https://dash.stannp.com/api/v1/groups/calculate/123?api_key={API_KEY}"); var request = new RestRequest(Method.POST); IRestResponse response = client.Execute(request); Console.WriteLine(response.Content)Response
{ "success": true, "data": true }
Delete a group
https://dash.stannp.com/api/v1/groups/delete
Parameters
id | int [required] | The id of the group to delete |
delete_recipients | bool [optional] |
True or false. Delete all recipients in this group if true. WARNING: If true this will completely delete the recipients so they will not exist in any other groups if the recipient was in multiple groups. Defaults to false. Which will not delete recipients. |
Request
$ curl https://dash.stannp.com/api/v1/groups/delete \ -u {API_KEY}: \ -d "id=123"
$curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://dash.stannp.com/api/v1/groups/delete?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( 'id' => "123" ), )); $response = curl_exec($curl); curl_close($curl); print_r($response);
import requests data = { 'id': '123' } response = requests.post('https://dash.stannp.com/api/v1/groups/delete?api_key={API_KEY}', data=data) print(response.text)
var client = new RestClient("https://dash.stannp.com/api/v1/groups/delete?api_key={API_KEY}"); var request = new RestRequest(Method.POST); request.AddParameter("id", "123"); IRestResponse response = client.Execute(request); Console.WriteLine(response.Content)Response
{ "success":true, "data":{} }