List Groups
Use the API to obtain a list of the mailing groups on your account. You can use the offset and limit parameters for pagination.
Request
using RestSharp;
var client = new RestClient("https://api-eu1.stannp.com/v1/groups/list?api_key={API_KEY}");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
Response
{ "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
Use the API to create a new empty mailing list.
Request
using RestSharp;
var client = new RestClient("https://api-eu1.stannp.com/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 Group
Use the API to add recipients from your account to an existing mailing list.
Request
using RestSharp;
var client = new RestClient("https://api-eu1.stannp.com/v1/groups/add/:group_id?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": 2 }
Remove Recipients from Group
Remove recipients from the group. Note that this only removes the recipient from the group and does not completely delete the recipient.
Request
using RestSharp;
var client = new RestClient("https://api-eu1.stannp.com/v1/groups/remove/:group_id?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": 2 }
Purge a Group
Use the API to remove all recipients from the mailing list. The recipients will remain on your account if delete_recipients is set to false.
Request
using RestSharp;
var client = new RestClient("https://api-eu1.stannp.com/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 }
Recalculate Group
Will recalculate a group to make sure stats are up to date.
Request
using RestSharp;
var client = new RestClient("https://api-eu1.stannp.com/v1/groups/calculate/:group_id?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
Use the API to delete a mailing list. The recipients will remain on your account if delete_recipients is set to false.
Request
using RestSharp;
var client = new RestClient("https://api-eu1.stannp.com/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": true }