3

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.

foxyblue
  • 2,859
  • 2
  • 21
  • 29
Keith Zhen
  • 45
  • 1
  • 1
  • 10

1 Answers1

6

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

foxyblue
  • 2,859
  • 2
  • 21
  • 29