Forums

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

Add comment and Do Transitions via rest api v3

Rajesh Ale February 10, 2022 edited
{
"update": {
"comment": [
{
"add": {
"body": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"text": "Hello There!!",
"type": "text"
} ]
} ]
}
}
}
]
},
"transition": {
"id": "71"
}
}



Above request works with rest api v2, any idea how to make it work for v3  .giving 204 message and adding comment . but ticket is not getting transitioned. 

 

5 answers

0 votes
Pramodh M
Community Champion
February 10, 2022

@Rajesh Ale 

It works only when you have a screen while transitioning the issue!

Using the comment or any other field to update the field while transitioning the issue is redundant

Place the transition screen in workflow to work

0 votes
Rajesh Ale February 10, 2022

cant we do both at same time  using edit issue or update issue ??

0 votes
Pramodh M
Community Champion
February 10, 2022

@Rajesh Ale 

For transitioning Issues, you need to get the transition ID first and then perform the transition

https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-transitions-get

https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-transitions-post

curl --request GET \
--url 'https://your-site.atlassian.net/rest/api/3/issue/WSP-198/transitions' \
--user 'email:token' \
--header 'Accept: application/json'

Get the Transition ID from above Response

curl --request POST \
--url 'https://your-site.atlassian.net/rest/api/3/issue/WSP-198/transitions' \
--user 'email:token' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"transition": {
"id": "51"
}
}' 

Let me know if you have any queries

Thanks,
Pramodh

0 votes
Rajesh Ale February 10, 2022

I guess you haven't read my question am trying to do both adding comment and do transitions at the same time .. not just adding comment 

Thanks for your comment

0 votes
Pramodh M
Community Champion
February 10, 2022

Hi @Rajesh Ale 

This works for adding comments to an issue

curl --request POST \
--url 'https://your-site.atlassian.net/rest/api/3/issue/WSP-198/comment' \
--user 'email:token' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"body": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"text": "Hello There!!",
"type": "text"
} ]
} ]
} }'

Reference here

https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-issue-issueidorkey-comment-post 

Suggest an answer

Log in or Sign up to answer