Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Comment Popup Handle via API

Harsh Kumar July 17, 2023

Hi, To move an issue to In Progress there is a dialog which opens up for comments. When doing this transition with API, the API fails with 400. Is there a way pop-up configuration can be detected when transitioning via API and then add comment?

 

~

Harsh

2 answers

1 accepted

0 votes
Answer accepted
Mohamed Benziane
Community Champion
July 17, 2023

Hi,

Welcome tot he community

If you have a transition screen with mandatory field you just need to add the field in your request during the API call.

Harsh Kumar July 17, 2023

Thanks. To do this, I suppose I can use this API?
/rest/api/2/issue/{issueIdOrKey}/transitions?expand=transitions.fields

{
    "update": {
        "comment": [
            {
                "add": {
                    "body": "Bug has been fixed."
                }
            }
        ]
    }
}
Mohamed Benziane
Community Champion
July 17, 2023

This api will show you all field that you can update during the transition.

So in Jira server you just have to call

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

in Jira Cloud

/rest/api/3/issue/{issueIdOrKey}/transitions
Like Harsh Kumar likes this
0 votes
Harsh Kumar July 17, 2023

Here is what worked for me.. Thanks..

curl --location 'https://<url>>/rest/api/2/issue/<<issue-id>/transitions?expand=transitions.fields' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic <<API Token>>' \
--header 'Cookie: atlassian.xsrf.token=e80648f3-50a4-4ca3-a537-0b8e89619848_769a8c178704cab15e24f59d2722e84e6e055ffc_lin' \
--data '{
"update": {
"comment": [
{
"add": {
"body": "Bug has been fixed."
}
}
]
},
"transition": {
"id": "1151"
}
}'

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events