Skip to content

Adding documentation to support comments in HTML #1429

Open
@tobenary

Description

@tobenary

Bug summary

This is not a bug but more of a documentation update: Comments
(I had to look into it for more than an hour, and I wish others would have it right away)

Please add the following method for getting comments in HTML format and not in "Atlassian Document Format (ADF)"

  1. Change the API version to 3:
    jira = JIRA( basic_auth=("<your_email>", "<your_api_key>"), # a username/password server="<Your Atlassian server>", options={"rest_api_version": 3} # We shall use API version 3 for this method - see https://community.atlassian.com/t5/Jira-questions/Atlassian-Document-Format-to-HTML/qaq-p/1024353

  2. Get an issue.
    issue = jira.issue("<ATL-KEY_number>")

  3. Get comments in HTML:
    for comment in jira.comments(issue.id, expand='renderedBody'): print(comment.renderedBody)

Is there an existing issue for this?

  • I have searched the existing issues

Jira Instance type

Jira Cloud (Hosted by Atlassian)

Jira instance version

Latest cloud

jira-python version

main

Python Interpreter version

3.9

Which operating systems have you used?

  • Linux
  • macOS
  • Windows

Reproduction steps

jira = JIRA(
    basic_auth=("<email>", "<API_KEY>"),  # a username/password
    server="https://YOUR_ATLASSIAN_SERVER.atlassian.net",
    options={"rest_api_version": 3}
)

# Get an issue.
issue = jira.issue("ALL-NUMBER")  # A project 'ALL' as example.

avoiding_types = ['app', 'atlassian']
for comment in jira.comments(issue.id, expand='renderedBody'):  # this is the main trick

    print(comment.author.accountType)
    print(comment.author.displayName)
    if comment.author.accountType not in avoiding_types:
        print(comment.author.emailAddress)
    print(comment.renderedBody)
    print(comment.created)

Stack trace

NONE - Documentation

Expected behaviour

NONE - Documentation

Additional Context

NONE - Documentation

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions