400 Bad request - INVALID_INPUT

My question:
I try to test POST requests on JIRA which eventually I have to create a ticket.
So I want to see if the server’s response POST, however, I get a “400 Bad request” error every time. Moreover, the error points out that “The request cannot be fulfilled due to bad syntax”.

Details (like screenshots):
image

image

How I found the problem / I’ve already tried:
Method → Post
Body → raw → JSON

{

"fields": {

   "project":{

      "key":"SA"

    },

   "summary":"Jira Rest API via Postman",

   "description":{

       "type":"doc",

       "version":1,

       "content":[{

               "type":"text",

               "text": "Creating an issue using project SA and issue type Story Using REST API via POSTMAN"

           }

       ]

   },

   "issuetype":{

      "name": "Story"

   }

}

}

I have tried this too:
{

"fields": {

    "project":

    {

        "key": "SA"

    },

    "summary": "Jira Rest API via Postman",

    "description": "Creating of an issue using project keys and issue type names using the REST API",

    "issuetype": {

        "name": "Story"

    }

}

}

Hi @lunar-module-techno1

Are you submitting the correct headers and using basic auth as per the info here?

There is an example curl that can be tweaked slightly and imported into Postman;
Try this to compare yours against.

curl -u “charlie:charlie” -XPOST -H “Content-type: application/json” -d ‘{see below}’ ‘http://localhost:8080/rest/api/2/issue/

Hi @w4dd325,

Thank you, For your response.

I think the description has some other type of format, in postman for JIRA.

My callout is working fine now. Find the new updated code below.

{

"fields": {

   "project":{

      "key":"SA"

    },

   "summary": "Jira Rest API via Postman",

    "description": [

    {

      "type": "text",

      "text": "This story is created by POSTMAN JIRA Rest API"

    }

  ],

   "issuetype":{

      "name": "Story"

   }

}

}

1 Like