Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

Can i able to add comment to my JIRA task using gulp?

Edited

 

HI Team,

 

How can i able to add comment to my jira task using gulp,

 

i have found below plugin in that they have mentioned we can add comment to jira task using this plugin

 

plugin - https://github.com/Pharb/gulp-jira-todo#getting-started

 

And i get some reference from here - https://developer.atlassian.com/server/jira/platform/jira-rest-api-example-add-comment-8946422/

 

How to do this...i want to add comment to my jira task using gulp

 

5 answers

2 votes
Daniel Eads Atlassian Team Feb 07, 2020

Hey @Kumaresan_Subramani ,

Thanks for including your steps and curl call here to help diagnose the issue you're seeing!

I see that you're trying to submit a comment to Jira Cloud. Earlier this year, we forced a change from passwords to API tokens in REST API calls. Based on the error you're seeing, I believe you may be passing your Jira password (rather than an API token) in your request. Switching to an API token should resolve this error.

Details about how to use these with Atlassian Cloud are listed here. In short, you generate a new token from id.atlassian.com and use that in place of a password. The advantage to this is that you can have multiple tokens on your account (one per application) and they can be easily revoked!

Cheers,
Daniel

HI @Daniel Eads ,

 

Thank You so much for your reply,

 

I have created `api token` and now i am facing below error while using below curl command

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

C:\Users\J**a>curl -u kumaresan.subramani:c************1 -X POST --data '{"body": "comment."}' -H "Content-type: application/json" https://****.atlassian.net/rest/api/2/issue/****/comment

ERROR Message

curl: (3) [globbing] unmatched close brace/bracket in column 9
{"errorMessages":["Unexpected character (''' (code 39)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: org.apache.catalina.connector.CoyoteInputStream@38a28add; line: 1, column: 2]"]}
C:\Users\JeevakanthPalaniappa>

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Then i discovered what i am missing from below issue:

https://community.atlassian.com/t5/Answers-Developer-Questions/How-to-add-comments-using-rest-api/qaq-p/571351#M115617

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

 

So i have tried my curl command like below but this command also throws an error:

 

C:\Users\J**a>curl -u kumaresan.subramani:c************1 -X POST --data "{\"body\": \"comment.\"}" -H "Content-type: application/json" https://****.atlassian.net/rest/api/2/issue/****/comment

ERROR Message

{"errorMessages":["Issue does not exist or you do not have permission to see it."],"errors":{}}

 

But task is in open stage and not get closed

 

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

 I have used below curl and referred from this documentation:

 

C:\Users\****>curl -D- -u kumaresan.subramani:**** -X POST --data { "body": "This is a comment regarding the quality of the response." } -H "Content-Type: application/json" https://****.atlassian.net/rest/api/2/issue/****/comment

 

ERROR Message
curl: (6) Could not resolve host: body
curl: (6) Could not resolve host: This is a comment regarding the quality of the response
curl: (3) [globbing] unmatched close brace/bracket in column 1
HTTP/1.1 400
Server: AtlassianProxy/1.15.8.1
Cache-Control: no-cache, no-store, no-transform
Content-Type: application/json;charset=UTF-8
Strict-Transport-Security: max-age=315360000; includeSubDomains; preload
Date: Sat, 08 Feb 2020 08:41:20 GMT
ATL-TraceId: e4edd21f9421b202
X-AREQUESTID: 98a45289-1e24-4411-9370-a917285fa323
X-XSS-Protection: 1; mode=block
Transfer-Encoding: chunked
Timing-Allow-Origin: *
X-Content-Type-Options: nosniff
Connection: close
Set-Cookie: atlassian.xsrf.token=B7SF-5IF6-KCX8-F16W_6fbd6434c26778501fa34b7fab8c1adb4d67a8c2_lout; Path=/; Secure   {"errorMessages":["Unexpected end-of-input: expected close marker for OBJECT (from [Source: org.apache.catalina.connector.CoyoteInputStream@7c8561d9; line: 1, column: 0])\n at [Source: org.apache.catalina.connector.CoyoteInputStream@7c8561d9; line: 1, column: 3]"]}

HI Team,

 

Kindly please update on this

 

Regards,

kumaresan S

Through jenkins pipeline

one more way to achieve my requirement through Jenkins stage using below plugin

plugin - https://github.com/jenkinsci/jira-steps-plugin  

Reference - https://jenkinsci.github.io/jira-steps-plugin/  

To Add Comment - https://jenkinsci.github.io/jira-steps-plugin/steps/comment/jira_add_comment/

 

I want to confirm which one is better and possible

Hi Team,

i came up with new way to achieve my requirement

Through Curl in gulp 

is this get work, i found these while searching

https://community.atlassian.com/t5/Answers-Developer-Questions/How-to-add-comments-using-rest-api/qaq-p/571351

If yes, please be little more details.

 

 

HI Guys,

 

kindly please provide solution for this.

 

i have tried below curl since i am facing new issue

 

curl -D- -u kumaresan.subramani:** -X POST --data "{\"body\": \"comment.\"}" -H "Content-Type: application/json" https://**.atlassian.net/rest/api/2/issue/***/comment


HTTP/1.1 404
Server: AtlassianProxy/1.15.8.1
Vary: Accept-Encoding
Cache-Control: no-cache, no-store, no-transform
Content-Type: application/json;charset=UTF-8
Strict-Transport-Security: max-age=315360000; includeSubDomains; preload
Date: Tue, 18 Feb 2020 12:56:28 GMT
ATL-TraceId: 6459289388132163
X-AREQUESTID: b340e20c-213f-42f5-a718-e7a17955d6b8
X-XSS-Protection: 1; mode=block
Transfer-Encoding: chunked
Timing-Allow-Origin: *
X-Content-Type-Options: nosniff
Connection: keep-alive
Set-Cookie: atlassian.xsrf.token=B7SF-5IF6-KCX8-F16W_a077ccd048f8990999231421db66ff93901a0952_lout; Path=/; Secure   {"errorMessages":["Issue does not exist or you do not have permission to see it."],"errors":{}}

 

I have used my api token only

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in DevOps

GitHub Script with GitHub Actions Automating Workflows

Hello folks, This is a series of articles where I explain GitHub Script with GitHub Actions and how you can automate publishing data on Atlassian & GitHub Platform based on the results of Workf...

109 views 1 2
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