Skip to content

Instantly share code, notes, and snippets.

@henrikj242
Last active November 27, 2017 10:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save henrikj242/51cbdb3c5cb431572d44df57abe3a1a8 to your computer and use it in GitHub Desktop.
Save henrikj242/51cbdb3c5cb431572d44df57abe3a1a8 to your computer and use it in GitHub Desktop.
using System;
using System.IO;
using System.Net;
using static System.Console;
public static class Program
{
static void Main()
{
WebClient client = new WebClient ();
string pmClient = "peytzmail-subdomain", mailinglistId = "mailing-list-id", startCriteria = "period_start=2017-11-01", userEmail = "api-user%40example.com", userToken = "sEcr3t";
// start_criteria can either be a date 'period_start=yyyy-mm-dd' or an id 'from_id=someEventId'.
// Save the last id from one request and use it in from_id in the next to get a continuous set of events
string url = String.Format("https://{0}.peytzmail.com/api/v1/subscriber_events/mailinglists/{1}.json?changes[]=unsubscribe&{2}&user_email={3}&user_token={4}",
pmClient, mailinglistId, startCriteria, userEmail, userToken
);
string reply = client.DownloadString (url);
Console.WriteLine (reply);
Console.ReadLine();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment