I am working on jira V3. When we get the jira issue from api we get the issue desciption in ADF format (I think) how to convert that format into HTML to show in our UI or there is any specific editor is given.
Thank You!
Hello @faisalamdani ,
If I understand correctly you are calling the /rest/api/3/issue/{issueIdOrKey} REST API endpoint and you are looking for a way to get the issue description in HTML.
Now, if my understanding is correct (provide more details otherwise), then all you have to do is to append the argument to expand the rendered fields to your REST API call, like in below example:
https://NAME.atlassian.net/rest/api/3/issue/{ISSUE-KEY_OR_ID}?expand=renderedFields
This way you will get the HTML for the text in the issue description.
For more details on expansion and for known issues, you may want to review the below links:
I hope this helps.
Cheers,Dario
Hello @faisalamdani
As an alternative to @Dario B's method, read this recent post Is there documentation for api.atlassian.com/pf-editor-service/convert? that describes an undocumented Atlassian REST API endpoint that converts ADF to HTML, markdown and a few others, and vice-versa. It means double processing of the issue description, but it works.
Apart from that, there are a few other open source Java and C# libraries that apparently do a reasonable job of converting ADF to HTML, but I've not tried any of them.
Hey @Dario B - this endpoint (https://api.atlassian.com/pf-editor-service) seems to be down. We're getting back a 404 not found.
Is this a known issue? Hope it comes back online - we found it super valuable and were using it in prod
@Aravindh Dorai ,
That's not an official endpoint and indeed it is not documented anywhere. Therefore it should not be used since it could change or stop working from one day to another without previous notice.
Got it. Would it be possible to open source the code for the convertor? It was super helpful to our team and users
For Python, see my recommendation HERE
for comment in jira.comments(issue.id, expand='renderedBody'): # this is the main trick print(comment.renderedBody)
The whole process:
from jira import JIRAjira = JIRA( basic_auth=("<email>", "<API_KEY>"), # a username/password_or_API_KEY server="https://YOUR_ATLASSIAN_SERVER.atlassian.net", options={"rest_api_version": 3} ) # Get an issue. issue = jira.issue("ALL-1234") # A project 'ALL' as example with issue number 1234. 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)
It looks like you're new here. Sign in or register to get started.