-2

i am using c# language for accessing MailJet Api,not sure what are the parameters required as has given for cURl i am newbie , how do i get started with it , please let me know any answer would be helpful

  • There's [an official API library](https://github.com/mailjet/mailjet-apiv3-dotnet) ([Mailjet.Api on NuGet](https://www.nuget.org/packages/Mailjet.Api/)) if you don't want to make the REST calls yourself. Or are you asking for help using that? – Rup Aug 31 '18 at 14:07

1 Answers1

2

Install the nuget package: Mailjet.Api

Review the documentation at: https://github.com/mailjet/mailjet-apiv3-dotnet

There are examples of code on there.

Here's an example piece of code from Github where a client is created and resource created.

MailjetClient client = new MailjetClient(ConfigurationManager.AppSettings["apiKey"], ConfigurationManager.AppSettings["apiSecret"]);

            MailjetRequest request = new MailjetRequest()
            {
                Resource = Contact.Resource,
            }
            .Property(Contact.Email, "Mister@mailjet.com");

            MailjetResponse response = await client.PostAsync(request);

            Console.WriteLine(string.Format("StatusCode: {0}\n", response.StatusCode));

            if (response.IsSuccessStatusCode)
            {
                Console.WriteLine(string.Format("Total: {0}, Count: {1}\n", response.GetTotal(), response.GetCount()));
                Console.WriteLine(response.GetData());
            }
            else
            {
                Console.WriteLine(string.Format("ErrorInfo: {0}\n", response.GetErrorInfo()));
                Console.WriteLine(string.Format("ErrorMessage: {0}\n", response.GetErrorMessage()));
            }
Ryan McDonough
  • 9,732
  • 3
  • 55
  • 76