How to transition a Jira through a Jira endpoint call

Asked

Viewed 14 times

-1

Boa Tarde Personal,

I’m trying to effect the transition of a Jira by calling a Jira endpoint. Researching, I discovered here that the endpoint would be:

POST /rest/api/2/issue/{issueIdOrKey}/transitions

As informed, the method to make this Jira status transition would be POST.

My question is to know what the content of the request is. What should I put on the body?

I tried that:

{
   "transition": {
    "id": "11"
  }
}

But it didn’t work. Postman reported:

415Unsupported Media Type

Note that I am using the id = 11, regarding status Work on it.

I also noticed that this same endpoint is used for the GET method (to recover all available transitions) and for the POST method (to make a certain transition from a Jira).

Could you help me?

1 answer

0

Error 415 is usually related to the type of call that was made, when the server cannot serve the request in the requested format.

According to the documentation you provided. You may have missed adding the header:

 --header 'Accept: application/json'
 --header 'Content-Type: application/json'

These headers are in the links provided by you in your question.

Follow the complete code of the link:

curl --request POST \
  --url '/rest/api/3/issue/{issueIdOrKey}/notify' \
  --user '[email protected]:<api_token>' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "htmlBody": "The <strong>latest</strong> test results for this ticket are now available.",
  "subject": "Latest test results",
  "textBody": "The latest test results for this ticket are now available.",
  "to": {
    "voters": true,
    "watchers": true,
    "groups": [
      {
        "name": "notification-group"
      }
    ],
    "reporter": false,
    "assignee": false,
    "users": [
      {
        "accountId": "5b10a2844c20165700ede21g",
        "active": false
      }
    ]
  },
  "restrict": {
    "permissions": [
      {
        "key": "BROWSE"
      }
    ],
    "groups": [
      {
        "name": "notification-group"
      }
    ]
  }
}'

Browser other questions tagged

You are not signed in. Login or sign up in order to post.