Keith Zhen
Keith Zhen

Reputation: 45

How to edit/update comment in Jira(Python)

I am trying to edit a comment in jira using jira-python, but I couldn't find anything.

I know add_comment will add a comment, but I also want to know how to edit a comment.

Upvotes: 3

Views: 13195

Answers (1)

s3bw
s3bw

Reputation: 3049

A comment is an object, similar to the issue so you can make edits in the same way, e.g:

If you know the ID:

# '10234' represents the comment id:
comment_to_edit = jira.comment('JIRA-1200', '10234')

comment_to_edit.update(body='Edit the content to something new.')

Alternatively if you have assigned the comment to a variable when you create it:

comment_to_edit = jira.add_comment('JIRA-1200', 'Change this content later')
comment_to_edit.update(body='New Content.')

If you need to find the ID you can get a list of the comments in an issue by:

list_of_comments = jira.comments('JIRA-1200')

More information can be found in the Docs

Upvotes: 6

Related Questions