diff options
author | Elmer Thomas <elmer@thinkingserious.com> | 2016-06-14 10:22:39 -0700 |
---|---|---|
committer | Elmer Thomas <elmer@thinkingserious.com> | 2016-06-14 10:22:39 -0700 |
commit | 1e2111f09142552d7dde4e18f116835dec91ed86 (patch) | |
tree | 1de111c549454450ce5a45aa129726132db217b5 /examples/stats/stats.cs | |
parent | 5ee89f857c09d79e507483bd807727bb6c4d7057 (diff) | |
parent | 2e52cfb07decb924a961b5c75ece1b9e79ab973c (diff) | |
download | sendgrid-csharp-7.0.1.zip sendgrid-csharp-7.0.1.tar.gz sendgrid-csharp-7.0.1.tar.bz2 |
Diffstat (limited to 'examples/stats/stats.cs')
-rw-r--r-- | examples/stats/stats.cs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/examples/stats/stats.cs b/examples/stats/stats.cs new file mode 100644 index 0000000..a363952 --- /dev/null +++ b/examples/stats/stats.cs @@ -0,0 +1,24 @@ +using System; +using SendGrid.Helpers.Mail; +using System.Collections.Generic; + +string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +dynamic sg = new SendGrid.SendGridAPIClient(_apiKey); + +//////////////////////////////////////////////////////// +// Retrieve global email statistics +// GET /stats + +string queryParams = @"{ + 'aggregated_by': 'day', + 'end_date': '2016-04-01', + 'limit': 1, + 'offset': 1, + 'start_date': '2016-01-01' +}"; +dynamic response = sg.client.stats.get(queryParams: queryParams); +Console.WriteLine(response.StatusCode); +Console.WriteLine(response.Body.ReadAsStringAsync().Result); +Console.WriteLine(response.Headers.ToString()); +Console.ReadLine(); + |