{"id":19100045,"url":"https://github.com/mailjet/mailjet-apiv3-dotnet","last_synced_at":"2026-02-23T13:19:38.038Z","repository":{"id":20550911,"uuid":"84835941","full_name":"mailjet/mailjet-apiv3-dotnet","owner":"mailjet","description":"[API v3] Official Mailjet API v3 .NET wrapper","archived":false,"fork":false,"pushed_at":"2024-02-26T09:20:24.000Z","size":193,"stargazers_count":75,"open_issues_count":12,"forks_count":31,"subscribers_count":18,"default_branch":"master","last_synced_at":"2024-11-02T23:07:09.113Z","etag":null,"topics":["csharp","dotnet","dotnetcore","email","email-marketing","mailjet","mailjet-api","transactional-emails","wrapper"],"latest_commit_sha":null,"homepage":"https://dev.mailjet.com","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mailjet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-03-13T14:27:46.000Z","updated_at":"2024-10-07T17:21:20.000Z","dependencies_parsed_at":"2023-11-28T23:39:54.028Z","dependency_job_id":null,"html_url":"https://github.com/mailjet/mailjet-apiv3-dotnet","commit_stats":{"total_commits":109,"total_committers":21,"mean_commits":5.190476190476191,"dds":0.6972477064220184,"last_synced_commit":"724e809cc2413f53ad4bebea637f0ce93824f7cb"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailjet%2Fmailjet-apiv3-dotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailjet%2Fmailjet-apiv3-dotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailjet%2Fmailjet-apiv3-dotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mailjet%2Fmailjet-apiv3-dotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mailjet","download_url":"https://codeload.github.com/mailjet/mailjet-apiv3-dotnet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225532791,"owners_count":17484135,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","dotnet","dotnetcore","email","email-marketing","mailjet","mailjet-api","transactional-emails","wrapper"],"created_at":"2024-11-09T03:52:27.088Z","updated_at":"2026-02-23T13:19:38.010Z","avatar_url":"https://github.com/mailjet.png","language":"C#","funding_links":[],"categories":["dotnet","csharp"],"sub_categories":[],"readme":"\n[doc]: http://dev.mailjet.com/\n[api_ref]: https://dev.mailjet.com/reference/email\n[api_credential]: https://app.mailjet.com/account/api_keys\n[issues]: https://github.com/mailjet/mailjet-apiv3-dotnet/issues\n[csharp_documentation]: http://dev.mailjet.com/guides/?csharp\n[api_doc_repo]: https://github.com/mailjet/api-documentation\n[nuget]: https://www.nuget.org/packages/Mailjet.Api/\n[smsDashboard]: https://app.mailjet.com/sms?_ga=2.81581655.1972348350.1522654521-1279766791.1506937572\n[smsInfo]: https://app.mailjet.com/docs/transactional-sms?_ga=2.183303910.1972348350.1522654521-1279766791.1506937572#sms-token\n[mailjet]: http://www.mailjet.com\n![alt text](https://www.mailjet.com/images/email/transac/logo_header.png \"Mailjet\")\n\n# Mailjet .NET Wrapper\n\n[![Build Status](https://travis-ci.org/mailjet/mailjet-apiv3-dotnet.svg?branch=master)](https://travis-ci.org/mailjet/mailjet-apiv3-dotnet)\n![Current Version](https://img.shields.io/badge/version-2.0.0-green.svg)\n\n## Overview\n\nWelcome to the [Mailjet][mailjet] official .NET API wrapper!\n\nCheck out all the resources and .NET code examples in the official [Mailjet Documentation][csharp_documentation].\n\n## Table of contents\n\n- [Mailjet .NET Wrapper](#mailjet-net-wrapper)\n  - [Overview](#overview)\n  - [Table of contents](#table-of-contents)\n  - [Release notes](#release-notes)\n  - [Compatibility](#compatibility)\n    - [Dependencies .NETStandard 1.1](#dependencies-netstandard-11)\n  - [Installation](#installation)\n  - [Authentication](#authentication)\n  - [Make your first call](#make-your-first-call)\n  - [Client / Call configuration specifics](#client--call-configuration-specifics)\n    - [Dependency Injection](#dependency-injection)\n    - [API Versioning](#api-versioning)\n    - [Base URL](#base-url)\n    - [Proxy](#proxy)\n  - [List of resources](#list-of-resources)\n  - [Request Examples](#request-examples)\n    - [POST Request](#post-request)\n      - [Simple POST request](#simple-post-request)\n      - [Using actions](#using-actions)\n    - [GET request](#get-request)\n      - [Retrieve all objects](#retrieve-all-objects)\n      - [Use filtering](#use-filtering)\n      - [Retrieve a single object](#retrieve-a-single-object)\n    - [PUT request](#put-request)\n    - [DELETE request](#delete-request)\n  - [SMS API](#sms-api)\n    - [Token authentication](#token-authentication)\n    - [Example request](#example-request)\n    - [Response](#response)\n  - [More examples](#more-examples)\n  - [Contribute](#contribute)\n\n## Release notes\n### v 3.0.0\n- bums version to indicate breaking change (removing extension methods like SendTransactionalEmailAsync)\n### v 2.1.0\n- bums newtonsoft.json version to not trigger security warnings\n- removes .net framework target to not trigger sectuiry warnings\n- moves SendTransactionalEmailAsync methds to the client itself to be able mock in unit tests\n### v 2.0.2\n   - TransactionalEmailBuidler extension now not exposed in the IMailjetClient interface\n### v 2.0.1\n   - TransactionalEmailBuidler now accepts variables of any type (previously only strings)\n### v 2.0.0\n   - Added TransactionalEmailBuidler and TransactionalEmail strongly typed models - now you can send transactional emails more easily! Please, check [tests for more information](Mailjet.Tests/Integration/SendTransactionalEmailIntegrationTests.cs)\n   - Added Contacts delete API - now you can support [GDPR delete contacts](https://dev.mailjet.com/email/guides/contact-management/#gdpr-delete-contacts) easily\n   - Removed ApiVersion from the client configuration - now client will determine needed API version automatically based on resource! Less configuration - easier life!\n   - Added strong name for the assembly for backward compatibility with .NET framework strong signed scenarios\n\n## Compatibility\n\nThis .NET library is supported by:\n\n - .NET Core 3.1+\n - .NET Framework 4.6.2\n - Mono 4.6\n - Xamarin.iOS 10.0\n - Xamarin.Android 7.0\n - Universal Windows Platform 10\n - Windows 8.0\n - Windows Phone 8.1\n\n### Dependencies .NETStandard 1.1\n\n - NETStandard.Library (\u003e= 1.6.1)\n - Newtonsoft.Json (\u003e= 13.0.1)\n\n## Installation\n\nYou can either clone the present Github repository or use NuGet package manager with the following command:\n\n```\nPM\u003e Install-Package Mailjet.Api\n```\n\nFor more information about our Nuget package, follow this [link][nuget].\n\n## Authentication\n\nThe Mailjet Email API uses your API and Secret keys for authentication. [Grab](api_credential) and save your Mailjet API credentials.\n\n```\nsetx -m $MJ_APIKEY_PUBLIC \"Enter your API Key here\"\nsetx -m $MJ_APIKEY_PRIVATE \"Enter your API Secret here\"\n```\n\n\n\u003e Note: For the SMS API the authorization is based on a Bearer token. See information about it in the [SMS API](#sms-api) section of the readme.\n\n## Make your first call\n\nHere's an example on how to send an email:\n\n```csharp\nusing Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n   class Program\n   {\n      /// \u003csummary\u003e\n      /// Run:\n      /// \u003c/summary\u003e\n      static void Main(string[] args)\n      {\n         // TODO: blocking call, try to use async Main and async eventhandlers in WinForms/WPF\n         RunAsync().Wait();\n      }\n\n      static async Task RunAsync()\n      {\n         MailjetClient client = new MailjetClient(\n            Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), \n            Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"));\n\n         MailjetRequest request = new MailjetRequest\n         {\n            Resource = Send.Resource\n         };\n\n         // construct your email with builder\n         var email = new TransactionalEmailBuilder()\n                .WithFrom(new SendContact(\"from@test.com\"))\n                .WithSubject(\"Test subject\")\n                .WithHtmlPart(\"\u003ch1\u003eHeader\u003c/h1\u003e\")\n                .WithTo(new SendContact(\"to@test.com\"))\n                .Build();\n\n         // invoke API to send email\n         var response = await client.SendTransactionalEmailAsync(email);\n\n         // check response\n         Assert.AreEqual(1, response.Messages.Length);\n      }\n   }\n}\n```\n\n## Client / Call configuration specifics\n\n### Dependency Injection\n\nThe MailJet client supports HttpClientFactory.\nTo configure IMailjetClient to be Typed HttpClient, see an example. \n```csharp\nservices.AddHttpClient\u003cIMailjetClient, MailjetClient\u003e(client =\u003e\n{\n    //set BaseAddress, MediaType, UserAgent\n    client.SetDefaultSettings();\n\n    client.UseBearerAuthentication(\"access_token\");\n    //or\n    client.UseBasicAuthentication(\"apiKey\", \"apiSecret\");\n});\n```\nThen IMailjetClient can be used like:\n```csharp\npublic class EmailService : IEmailService\n{\n    private readonly IMailjetClient _mailjetClient;\n\n    public EmailService(IMailjetClient mailjetClient)\n    {\n        _mailjetClient = mailjetClient;\n    }\n}\n```\n\n### API Versioning\n\nThe Mailjet API is spread among three distinct versions:\n\n- v3 : `ApiVersion.V3` - The Email API\n- v3.1 : `ApiVersion.V3_1` - Email Send API v3.1, which is the latest version of our Send API\n- v4 : `ApiVersion.V4` - SMS API, contacts delete API etc\n\nRight now, client wrapper will determine what API version to call under the hood.\n\nFor additional information refer to our [API Reference](https://dev.preprod.mailjet.com/reference/overview/versioning/).\n\n### Base URL\n\nThe default base domain name for the Mailjet API is `https://api.mailjet.com`. You can modify this base URL by setting a value for `BaseAdress` in your call:\n\n```csharp\nMailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"))\n         {\n            BaseAdress = \"https://api.us.mailjet.com\",\n         };\n```\n\nIf your account has been moved to Mailjet's US architecture, the URL value you need to set is `https://api.us.mailjet.com`.\n\n### Proxy\n\nYou can set proxy for the client by passing it's parameters to the httpClientHandler:\n\n```csharp\n            // create instance of proxy with configuration\n            var proxy = new WebProxy\n            {\n                // Credentials = new NetworkCredential(\"\u003cproxyusername\u003e\", \"\u003cproxypassword\u003e\"),\n                // if your proxy requires credentials, uncomment this line ^^\n\n                // address of the proxy\n                // please, note - even if it's https proxy, the address should start from http\n                // https://github.com/dotnet/core/issues/2043\n                Address = new Uri(\"http://51.79.xx.xx:8080\"),\n\n                UseDefaultCredentials = false\n            };\n\n            // pass the created proxy to HttpClientHandler\n            HttpClientHandler handler = new HttpClientHandler\n            {\n                Proxy = proxy,\n            };\n\n            // pass HttpClientHandler to the MailjetClient, so client will be using a proxy\n            var client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"),\n                Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"), handler);\n\n            // use client here...\n```\n\n## List of resources\n\nYou can find the list of all available resources for this library in, as well as their configuration, in [/Mailjet.Client/Resources](https://github.com/mailjet/mailjet-apiv3-dotnet/tree/master/Mailjet.Client/Resources). Check the [API reference][api_ref] for complete details on the functionality of these resources.\n\n## Request Examples\n\n### POST Request\n\nUse the `PostAsync` method of the Mailjet CLient (i.e. `MailjetResponse response = await client.PostAsync(request);`).\n`request` will be a `MailjetRequest` object.\n\n#### Simple POST request\n\n```csharp\nusing Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n   class Program\n   {\n      /// \u003csummary\u003e\n      /// Create a new contact:\n      /// \u003c/summary\u003e\n      static void Main(string[] args)\n      {\n         // TODO: blocking call, try to use async Main and async eventhandlers in WinForms/WPF\n         RunAsync().Wait();\n      }\n      static async Task RunAsync()\n      {\n         MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"));\n         MailjetRequest request = new MailjetRequest\n         {\n            Resource = Contact.Resource,\n         }\n            .Property(Contact.Email, \"passenger@mailjet.com\")\n            .Property(Contact.IsExcludedFromCampaigns, \"false\")\n            .Property(Contact.Name, \"New Contact\");\n         MailjetResponse response = await client.PostAsync(request);\n         if (response.IsSuccessStatusCode)\n         {\n            Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n            Console.WriteLine(response.GetData());\n         }\n         else\n         {\n            Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n            Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n            Console.WriteLine(response.GetData());\n            Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n         }\n      }\n   }\n}\n```\n\n#### Using actions\n\nTo access endpoints with action, you will be able to find Resources object definition. For example, the `/Contact/$ID/Managecontactslists` endpoint can be used with the object `ContactManagecontactslists` available in `Mailjet.Client.Resources` \n\n```csharp\nusing Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n   class Program\n   {\n      /// \u003csummary\u003e\n      /// Manage the subscription status of a contact to multiple lists\n      /// \u003c/summary\u003e\n      static void Main(string[] args)\n      {\n         RunAsync().Wait();\n      }\n      static async Task RunAsync()\n      {\n         MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"));\n         MailjetRequest request = new MailjetRequest\n         {\n            Resource = ContactManagecontactslists.Resource,\n            ResourceId = ResourceId.Numeric(ID)\n         }\n            .Property(ContactManagecontactslists.ContactsLists, new JArray {\n                new JObject {\n                 {\"ListID\", \"$ListID_1\"},\n                 {\"Action\", \"addnoforce\"}\n                 },\n                new JObject {\n                 {\"ListID\", \"$ListID_2\"},\n                 {\"Action\", \"addforce\"}\n                 }\n                });\n         MailjetResponse response = await client.PostAsync(request);\n         if (response.IsSuccessStatusCode)\n         {\n            Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n            Console.WriteLine(response.GetData());\n         }\n         else\n         {\n            Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n            Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n            Console.WriteLine(response.GetData());\n            Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n         }\n      }\n   }\n}\n```\n\n### GET request\n\nUse the `PostAsync` method of the Mailjet CLient (i.e. `MailjetResponse response = await client.GetAsync(request);`).\n`request` will be a `MailjetRequest` object.\n\n#### Retrieve all objects\n\n```csharp\nusing Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n   class Program\n   {\n      /// \u003csummary\u003e\n      /// Retrieve all contacts\n      /// \u003c/summary\u003e\n      static void Main(string[] args)\n      {\n         RunAsync().Wait();\n      }\n      static async Task RunAsync()\n      {\n         MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"));\n         MailjetRequest request = new MailjetRequest\n         {\n            Resource = Contact.Resource,\n         }\n         MailjetResponse response = await client.GetAsync(request);\n         if (response.IsSuccessStatusCode)\n         {\n            Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n            Console.WriteLine(response.GetData());\n         }\n         else\n         {\n            Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n            Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n            Console.WriteLine(response.GetData());\n            Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n         }\n      }\n   }\n}\n```\n\n#### Use filtering\n\nIn case API endpoint supports query params filtering, you can add filter for your API call on the `MailjetRequest` by using the `Filter` method. \nExample: `.Filter(Contact.IsExcludedFromCampaigns, \"false\")`\n\n```csharp\nusing Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n   class Program\n   {\n      /// \u003csummary\u003e\n      /// Retrieve all contacts\n      /// \u003c/summary\u003e\n      static void Main(string[] args)\n      {\n         RunAsync().Wait();\n      }\n      static async Task RunAsync()\n      {\n         MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"));\n         MailjetRequest request = new MailjetRequest\n         {\n            Resource = Contact.Resource,\n         }\n         .Filter(Contact.IsExcludedFromCampaigns, \"false\")         \n         MailjetResponse response = await client.GetAsync(request);\n         if (response.IsSuccessStatusCode)\n         {\n            Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n            Console.WriteLine(response.GetData());\n         }\n         else\n         {\n            Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n            Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n            Console.WriteLine(response.GetData());\n            Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n         }\n      }\n   }\n}\n```\n\nTo filter resource by it's identifier, common REST style convention is used, so you can specify resource id in the request itself. For example, you can get single contact by email:\n\n```csharp\nMailjetRequest request = new MailjetRequest\n{\n    Resource = Contact.Resource,\n    ResourceId = ResourceId.Alphanumeric(email)\n};\n\nMailjetResponse response = await client.GetAsync(request);\n```\n\n#### Retrieve a single object\n\nWhen instantiating the `MailjetRequest`, you can specify the Id of the resource you want to access with `ResourceId` (example: `ResourceId = ResourceId.Numeric(ID)`).\n\n```csharp\nusing Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n   class Program\n   {\n      /// \u003csummary\u003e\n      /// View : Retrieve a specific contact. Includes information about contact status and creation / activity timestamps.\n      /// \u003c/summary\u003e\n      static void Main(string[] args)\n      {\n         RunAsync().Wait();\n      }\n      static async Task RunAsync()\n      {\n         MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"));\n         MailjetRequest request = new MailjetRequest\n         {\n            Resource = Contact.Resource,\n            ResourceId = ResourceId.Numeric(ID)\n         }\n         MailjetResponse response = await client.GetAsync(request);\n         if (response.IsSuccessStatusCode)\n         {\n            Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n            Console.WriteLine(response.GetData());\n         }\n         else\n         {\n            Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n            Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n            Console.WriteLine(response.GetData());\n            Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n         }\n      }\n   }\n}\n```\n\n### PUT request\n\nA `PUT` request in the Mailjet API will work as a `PATCH` request - the update will affect only the specified properties. The other properties of an existing resource will neither be modified, nor deleted. It also means that all non-mandatory properties can be omitted from your payload.\n\nUse the `PutAsync` method of the Mailjet CLient (i.e. `MailjetResponse response = await client.PutAsync(request);`).\n`request` will be a `MailjetRequest` object.\n\n```csharp\nusing Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n   class Program\n   {\n      /// \u003csummary\u003e\n      /// Modify : Modify the static custom contact data\n      /// \u003c/summary\u003e\n      static void Main(string[] args)\n      {\n         RunAsync().Wait();\n      }\n      static async Task RunAsync()\n      {\n         MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"));\n         MailjetRequest request = new MailjetRequest\n         {\n            Resource = Contactdata.Resource,\n            ResourceId = ResourceId.Numeric(ID)\n         }\n            .Property(Contactdata.Data, new JArray {\n                new JObject {\n                 {\"first_name\", \"John\"},\n                 {\"last_name\", \"Smith\"}\n                 }\n                });\n         MailjetResponse response = await client.PutAsync(request);\n         if (response.IsSuccessStatusCode)\n         {\n            Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n            Console.WriteLine(response.GetData());\n         }\n         else\n         {\n            Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n            Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n            Console.WriteLine(response.GetData());\n            Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n         }\n      }\n   }\n}\n```\n\n### DELETE request\n\nUpon a successful `DELETE` request the response will not include a response body, but only a `204 No Content` response code.\n\nUse the `DeleteAsync` method of the Mailjet CLient (i.e. `MailjetResponse response = await client.DeleteAsync(request);`).\n`request` will be a `MailjetRequest` object.\n\n```csharp\nusing Mailjet.Client;\nusing Mailjet.Client.Resources;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n   class Program\n   {\n      /// \u003csummary\u003e\n      /// Delete : Delete an email template.\n      /// \u003c/summary\u003e\n      static void Main(string[] args)\n      {\n         RunAsync().Wait();\n      }\n      static async Task RunAsync()\n      {\n         MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"MJ_APIKEY_PUBLIC\"), Environment.GetEnvironmentVariable(\"MJ_APIKEY_PRIVATE\"));\n         MailjetRequest request = new MailjetRequest\n         {\n            Resource = Template.Resource,\n            ResourceId = ResourceId.Numeric(ID)\n         }\n         MailjetResponse response = await client.DeleteAsync(request);\n         if (response.IsSuccessStatusCode)\n         {\n            Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n            Console.WriteLine(response.GetData());\n         }\n         else\n         {\n            Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n            Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n            Console.WriteLine(response.GetData());\n            Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n         }\n      }\n   }\n}\n```\n## SMS API\n\n### Token authentication\n\nAuthentication for the SMS API endpoints is done using a bearer token. The bearer token is generated in the [SMS section](https://app.mailjet.com/sms) of your Mailjet account.\n\nTo use a Bearer token you will need to client clientin from:\n\n```csharp\n...\n\tMailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"Your_Bearer_token\"));\n...\n```\n\n### Example request\n\n```csharp\nusing Mailjet.Client;\nusing Mailjet.Client.Resources.SMS;\nusing System;\nusing Newtonsoft.Json.Linq;\nnamespace Mailjet.ConsoleApplication\n{\n   class Program\n   {\n      /// \u003csummary\u003e\n      /// Send an SMS:\n      /// \u003c/summary\u003e\n      static void Main(string[] args)\n      {\n         RunAsync().Wait();\n      }\n      static async Task RunAsync()\n      {\n         MailjetClient client = new MailjetClient(Environment.GetEnvironmentVariable(\"Your_Bearer_token\"));\n\n         MailjetRequest request = new MailjetRequest\n         {\n            Resource = Send.Resource,\n         }\n         .Property(Send.From, \"MJ Pilot\")\n         .Property(Send.To, \"+336000000000\")\n         .Property(Send.Text, \"Have a nice SMS flight with Mailjet !\");\n\n         MailjetResponse response = await client.PostAsync(request);\n         if (response.IsSuccessStatusCode)\n         {\n            Console.WriteLine(string.Format(\"Total: {0}, Count: {1}\\n\", response.GetTotal(), response.GetCount()));\n            Console.WriteLine(response.GetData());\n         }\n         else\n         {\n            Console.WriteLine(string.Format(\"StatusCode: {0}\\n\", response.StatusCode));\n            Console.WriteLine(string.Format(\"ErrorInfo: {0}\\n\", response.GetErrorInfo()));\n            Console.WriteLine(response.GetData());\n            Console.WriteLine(string.Format(\"ErrorMessage: {0}\\n\", response.GetErrorMessage()));\n         }\n      }\n   }\n}\n```\n### Response \n\nThe `GetAsync`, `PostAsync`, `PutAsync` and `DeleteAsync` method will return a `MailjetResponse` object with the following available methods and properties:\n\n - `IsSuccessStatusCode` : indicate if the API call was successful\n - `StatusCode` : http status code (ie: 200,400 ...)\n - `GetData()` : content of the property `data` of the JSON response payload if exist or the full JSON payload returned by the API call. This will be PHP associative array.   \n - `GetCount()` : number of elements returned in the response\n - `GetErrorInfo()` : http response message phrases (\"OK\", \"Bad Request\" ...)\n - `GetErrorMessage()` :  error reason message from the API response payload\n\n\n## More examples\n\n* [Send with attached files](https://dev.mailjet.com/email/guides/send-api-v31/#send-with-attached-files)\n\n* [GDPR Delete contacts](https://dev.mailjet.com/email/guides/contact-management/#gdpr-delete-contacts)\n* and many more can be found can under [guides section](https://dev.mailjet.com/email/guides/) on our docs site\n\n## Contribute\n\nMailjet loves developers. You can be part of this project!\n\nThis wrapper is a great introduction to the open source world, check out the code!\n\nFeel free to ask anything, and contribute:\n\n- Fork the project.\n- Create a new branch.\n- Implement your feature or bug fix.\n- Add documentation to it.\n- Commit, push, open a pull request and voila.\n\nIf you have suggestions on how to improve the guides, please submit an issue in our [Official API Documentation repo](https://github.com/mailjet/api-documentation).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmailjet%2Fmailjet-apiv3-dotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmailjet%2Fmailjet-apiv3-dotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmailjet%2Fmailjet-apiv3-dotnet/lists"}