Richard Christensen
Richard Christensen

Reputation: 2166

JIRA REST API Upload Attachment

I am using JIRA and I am trying to upload an attachment, everything seems to work just fine as I can see the file has successfully attached to the issue. However when I try to view the attachment I get a File not found error in JIRA.

I beleive it to be because of the file name:

/Users/Me/files/report.txt

when it uploads the link is set to

https://{JIRA.url}/secure/attachment/{issue-id}/%2FUsers%2Fme%2Ffiles%2FReport.txt

The 404 message is The requested URL /secure/attachment/15904//Users/me/files/Report.txt was not found on this server.

The double // before Users is what is causing me to suspect the filepath is creating a server error.

I am wondering if there is another POST field I need to use to change the filename of the uploaded attachment.

Upvotes: 1

Views: 1546

Answers (1)

Richard Christensen
Richard Christensen

Reputation: 2166

Apparently it is a bug in php curl.

https://bugs.php.net/bug.php?id=48962

after finding this I discovered that I could change my post parameter from

"file=@/Users/Me/files/report.txt";

to

"file=@/Users/Me/files/report.txt;filename=report.txt";

and everything works just fine.

Upvotes: 4

Related Questions