Search code examples
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" : "[email protected]"
        }
      ],
      "subject" : "Hello, World!"
    }
  ],
  "from" : {
    "email" : "[email protected]"
  }
}

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!!!