summaryrefslogtreecommitdiffstats
path: root/examples/ips/ips.cs
diff options
context:
space:
mode:
authorElmer Thomas <elmer@ThinkingSerious.com>2016-07-18 14:17:13 -0700
committerGitHub <noreply@github.com>2016-07-18 14:17:13 -0700
commite77fd46dd863f51cd5fb5786a50002968858379f (patch)
treeb51575c984fe94d7498e91b5d3ff05d46c6a9725 /examples/ips/ips.cs
parent7d04be36d6a73ed69dd6ccbc0fb6590d3be94587 (diff)
parent9d48986ef4662e9cd91235ef91fc097ca07e7a8d (diff)
downloadsendgrid-csharp-e77fd46dd863f51cd5fb5786a50002968858379f.zip
sendgrid-csharp-e77fd46dd863f51cd5fb5786a50002968858379f.tar.gz
sendgrid-csharp-e77fd46dd863f51cd5fb5786a50002968858379f.tar.bz2
Merge pull request #282 from sendgrid/256-bad-json
256 bad json
Diffstat (limited to 'examples/ips/ips.cs')
-rw-r--r--examples/ips/ips.cs9
1 files changed, 9 insertions, 0 deletions
diff --git a/examples/ips/ips.cs b/examples/ips/ips.cs
index 26f5503..b72fe55 100644
--- a/examples/ips/ips.cs
+++ b/examples/ips/ips.cs
@@ -1,5 +1,6 @@
using System;
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
+using Newtonsoft.Json; // You can generate your JSON string yourelf or with another library if you prefer
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
@@ -38,6 +39,8 @@ Console.ReadLine();
string data = @"{
'name': 'marketing'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.ips.pools.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
@@ -61,6 +64,8 @@ Console.ReadLine();
string data = @"{
'name': 'new_pool_name'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var pool_name = "test_url_param";
dynamic response = sg.client.ips.pools._(pool_name).put(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -97,6 +102,8 @@ Console.ReadLine();
string data = @"{
'ip': '0.0.0.0'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
var pool_name = "test_url_param";
dynamic response = sg.client.ips.pools._(pool_name).ips.post(requestBody: data);
Console.WriteLine(response.StatusCode);
@@ -123,6 +130,8 @@ Console.ReadLine();
string data = @"{
'ip': '0.0.0.0'
}";
+Object json = JsonConvert.DeserializeObject<Object>(data);
+data = json.ToString();
dynamic response = sg.client.ips.warmup.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);