diff options
author | Elmer Thomas <elmer@ThinkingSerious.com> | 2015-12-10 23:23:24 -0800 |
---|---|---|
committer | Elmer Thomas <elmer@ThinkingSerious.com> | 2015-12-10 23:23:24 -0800 |
commit | 5391fbe59c8be7e23f4b89786bdca0063d4730d0 (patch) | |
tree | e1a72df8cf438b53341b747e190eeba23cc92d39 /README.md | |
parent | 6d5b3a4c261f25fa308e5a1e87ff1242804db0b1 (diff) | |
parent | 56af17b2b4c5021fa1a5584b662cd8bfd053b3b0 (diff) | |
download | sendgrid-csharp-5391fbe59c8be7e23f4b89786bdca0063d4730d0.zip sendgrid-csharp-5391fbe59c8be7e23f4b89786bdca0063d4730d0.tar.gz sendgrid-csharp-5391fbe59c8be7e23f4b89786bdca0063d4730d0.tar.bz2 |
Merge pull request #166 from sendgrid/asm_groups_get_postv6.3.1
Asm groups [GET, POST, DELETE]
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 48 |
1 files changed, 48 insertions, 0 deletions
@@ -193,6 +193,54 @@ ver apiKeyId = "<API Key ID>"; HttpResponseMessage responseDelete = client.ApiKeys.Delete(apiKeyId).Result; ``` +## Unsubscribe Groups ## + +Please refer to [our documentation](https://sendgrid.com/docs/API_Reference/Web_API_v3/Suppression_Management/groups.html) for further details. + +Retrieve all suppression groups associated with the user. [GET] + +```csharp +String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +var client = new SendGrid.Client(apiKey); +// Leave off .Result for an asyncronous call +HttpResponseMessage responseGet = client.ApiKeys.Get().Result; +``` + +Get information on a single suppression group. [GET] + +```csharp +String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +var client = new SendGrid.Client(apiKey); +// Leave off .Result for an asyncronous call +HttpResponseMessage responseGet = client.UnsubscribeGroups.Get().Result; +``` + +Create a new suppression group. [POST] + +There is a limit of 25 groups per user. + +```csharp +String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +var client = new SendGrid.Client(apiKey); +var unsubscribeGroupName = "CSharpTestUnsubscribeGroup"; +var unsubscribeGroupDescription = "CSharp test Unsubscribe Group description."; +var unsubscribeGroupIsDefault = false; +// Leave off .Result for an asyncronous call +HttpResponseMessage responsePost = client.UnsubscribeGroups.Post(unsubscribeGroupName, unsubscribeGroupDescription, unsubscribeGroupIsDefault ).Result; +``` + +Delete a suppression group. [DELETE] + +You can only delete groups that have not been attached to sent mail in the last 60 days. If a recipient uses the “one-click unsubscribe” option on an email associated with a deleted group, that recipient will be added to the global suppression list. + +```csharp +String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); +var client = new SendGrid.Client(apiKey); +ver unsubscribeGroupId = "<UNSUBSCRIBE GROUP ID>"; +// Leave off .Result for an asyncronous call +HttpResponseMessage responseDelete = client.UnsubscribeGroups.Delete(unsubscribeGroupId).Result; +``` + #How to: Testing * Load the solution (We have tested using the Visual Studio Community Edition) |