Unable to add comment via REST API

Tarun Sapra Community Champion Nov 26, 2013

Hi,

I am unable to add a comment via REST API and can't seem to figure out the issue.

C:\>curl -k -D- -u tsapra:xxxxx -X POST --data test.text
-H "Content-Type: application/json" https://testjira.com/rest/api/2/issue/KJA-19/comment

amd the test.txt file contains -

{

"body": "This request was originally written in French, which most of our developers can't read"

}

I have also tried with file name test.json.

I get the response ---

HTTP/1.1 400 Bad Request

Date: Wed, 27 Nov 2013 11:40:48 GMT

Server: Apache-Coyote/1.1

X-AREQUESTID: 760x2036x1

X-Seraph-LoginReason: OK

X-ASESSIONID: 1cxk3g1

X-AUSERNAME: tsapra

Cache-Control: no-cache, no-store, no-transform

Content-Type: application/json;charset=UTF-8

Connection: close

Transfer-Encoding: chunked

{"errorMessages":["Unrecognized token 'tettx': was expecting 'null', 'true', 'fa

lse' or NaN\n at [Source: org.apache.catalina.connector.CoyoteInputStream@63035e

a2; line: 1, column: 19]"]}

1 answer

1 accepted

This widget could not be displayed.
Pedro Cora Atlassian Team Nov 26, 2013

Try adding an "@" in front of the file name.

It works for me like this:

curl -k -D- -u pcora:sphere -X POST --data @comment.txt -H "Content-Type: application/json" http://localhost:8080/rest/api/2/issue/AWD-1/comment

Tarun Sapra Community Champion Nov 26, 2013

hi when I use @, I get the following error.

Warning: Couldn't read data from file "test.text", this makes an empty POST.

Pedro Cora Atlassian Team Nov 26, 2013

Is the filename test.text or test.txt?

Tarun Sapra Community Champion Nov 26, 2013

i need more sleep ;)

cheers

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

99 views 1 0
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you