Need to convert HTML to Jira markup language through REST API

Manjunath Rajappa October 10, 2019

Hi All,

 

We need help in converting HTML code to Jira markup language.

An example:  To create a table in description we have HTML table code and need to convert that to Jira markup language which will create a table through REST API to update an issue.

Can anyone help with this

This is the HTML code

<!DOCTYPE html>

<html>

<body>

<h2>HTML Table</h2>

<table>
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr>
<tr>
<td>Centro comercial Moctezuma</td>
<td>Francisco Chang</td>
<td>Mexico</td>
</tr>
<tr>
</table>

</body>
</html>

 I need to convert this to Jira Markup language like this(this will create a table)

||Company||Contact||Country||
|Alfreds Futterkiste|Maria Anders|Germany|
|Centro comercial Moctezuma|Francisco Chang|Mexico|

FYI We have tried with  com.atlassian.renderer.wysiwyg.converter.DefaultWysiwygConverter  (this was mentioned in some questions for a solution) will convert to text type, not Jira markup language.

 

1 answer

0 votes
fran garcia gomera
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 11, 2019

I'm using Jira Software 7.12.3 and this is working for me

POST /rest/api/2/issue/{issueIdOrKey}/comment
{
"body":"||Company||Contact||Country||\n|Alfreds Futterkiste|Maria Anders|Germany|\n|Centro comercial Moctezuma|Francisco Chang|Mexico|",
"visibility": {
"type": "role",
"value": "Administrators"
}
}

table.png

Manjunath Rajappa October 11, 2019

Hi  @fran garcia gomera 

It will work if you provide ' | ' between words.

my question is If I have an HTML code how do I convert that to Jira markup language.

fran garcia gomera
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 11, 2019

Sorry, i didn't understand your question properly.

Hope you find a solution.

Suggest an answer

Log in or Sign up to answer