Jira Add Attachment REST API

Nihad Azimli November 14, 2018

I try to add attachment file to opened issue through POSTMAN or curl to Jira. However, it returns me 404 error. I do not have any problem with permissions, since, I checked all of them with other REST API from Jira, also, the file I send has only 4 kb of data and it is '.txt' file. I did my request according to following url: https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-api-3-issue-issueIdOrKey-attachments-post

 

curl -D- -u n***a:1*****a -X POST -H "X-Atlassian-Token: no-check" -F "file=@notefromfin.txt" http://tracker.*******.com/rest/api/3/issue/QS*R-596/attachment

 

1 answer

1 accepted

1 vote
Answer accepted
Alexey Matveev
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.
November 14, 2018

Hello,

You use Jira Cloud rest api. Are you on Cloud?

Nihad Azimli November 14, 2018

No, I am on server. Is it the problem?

Nihad Azimli November 14, 2018
curl -D- -u {username}:{password} -X POST -H "X-Atlassian-Token: nocheck" -F "file=@{path/to/file}" http://{base-url}/rest/api/2/issue/{issue-key}/attachments

I have to use this one, right?

Alexey Matveev
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.
November 14, 2018

Yes, That is the problem.

You should use /rest/api/2/issue/{issueIdOrKey}/attachments:

https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/#api/2/issue/{issueIdOrKey}/attachments

Like # people like this
Somanath P
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 22, 2020

@Alexey Matveev

Can you give me an exampl,e, I am Providing location of file with extension but its throwing error. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events