It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Posting external link as comment to Jira using Node.js Edited

greg chap I'm New Here Nov 03, 2019

I am posting a comment with some text and external link combined as string using jira rest api(v3). Looks like below


"text [test|https://www.test.com]"

Comment shows up as normal text without external link on the jira issue. Because it adds a **backslash** before the first square bracket. Even though it looks correct on jira ticket, as soon as I select Edit on the comment, i see


text \[test|https://www.test.com]

so I tried unicode for the square bracket and posted comment like below


text [test|https://test.com]

It shows correctly as comment, but again without the external link. I tried adding couple of \\ before the first square bracket, I tried double square brackets around the external link as well, but no luck.


I am following the documentation they had for adding comment right below

 https://developer.atlassian.com/cloud/jira/platform/rest/v3/?utm_source=%2Fcloud%2Fjira%2Fplatform%2Frest%2F&utm_medium=302#api-rest-api-3-issue-issueIdOrKey-comment-post 

Basically my request is as below


var bodyData = `{
"visibility": {
"type": "role",
"value": "Administrators"
},
"body": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"text": "text [test|https://www.test.com]",
"type": "text"
}
]
}
]
}
}`;

var options = {
method: 'POST',
url: '/rest/api/3/issue/{issueIdOrKey}/comment',
auth: { username: 'email@example.com', password: '<api_token>' },
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: bodyData
};

request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(
'Response: ' + response.statusCode + ' ' + response.statusMessage
);
console.log(body);
});

Any thoughts on what I am missing?

0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira

The add-in you’ve been waiting for: Jira Cloud for Excel 🙌

Introducing Jira Cloud for Excel Here at the product integrations team at Atlassian, we are thrilled to announce the new Jira Cloud for Excel add-in! This add-in lets you export Jira data directly ...

842 views 5 22
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you