sendgridbad-request

SendGrid API V3 returns 400 Bad Request


I am trying to achieve send of mail via SendGrid API.

Following is the JSON I am sending as a body of the POST Method

{
  "content" : [
    {
      "type" : "text\/plain",
      "value" : "Hello, World!"
    }
  ],
  "personalizations" : [
    {
      "to" : [
        {
          "email" : "sahpranav1712@gmail.com"
        }
      ],
      "subject" : "Hello, World!"
    }
  ],
  "from" : {
    "email" : "iospranav1712@gmail.com"
  }
}

and following is the return that I am getting

{"message":"Bad Request","field":null,"help":null}

This piece of info doesn't help much.

The authorization is in place, and I believe correctly.

Perhaps, I might have missed some sort of settings in the SendGrid App

If it helps im using Objective-C.

Please help!!


Solution

  • Not setting [manager setRequestSerializer:[AFJSONRequestSerializer serializer]]; was the issue!!!