diff options
author | Elmer Thomas <elmer@thinkingserious.com> | 2016-06-01 10:50:02 -0700 |
---|---|---|
committer | Elmer Thomas <elmer@thinkingserious.com> | 2016-06-01 10:50:02 -0700 |
commit | 4cde4e7ee0329c179fa8745655a602521f1c2dd8 (patch) | |
tree | b1cf20f427ef68c644f6c0cd724b72440d53728d /examples/stats/stats.cs | |
parent | 5e5c58f4245647611eb33e03d26d032b7ec2b26e (diff) | |
download | sendgrid-csharp-4cde4e7ee0329c179fa8745655a602521f1c2dd8.zip sendgrid-csharp-4cde4e7ee0329c179fa8745655a602521f1c2dd8.tar.gz sendgrid-csharp-4cde4e7ee0329c179fa8745655a602521f1c2dd8.tar.bz2 |
Added examples for v3 Web API endpoints
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..7506b9b --- /dev/null +++ b/examples/stats/stats.cs @@ -0,0 +1,24 @@ +using System; +using SendGrid.Helpers.Mail; +using System.Collections.Generic; +using System.Net; + +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.ResponseBody.ReadAsStringAsync().Result); +Console.WriteLine(response.ResponseHeaders.ToString()); + |