Add Attachment via REST API Jira Data Center 9.17.0

joseph daniels
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!
February 20, 2025

We are trying to programmatically add attachments to Issues via REST API.

Found an example here - 

https://confluence.atlassian.com/jirakb/how-to-add-an-attachment-to-a-jira-issue-using-rest-api-699957734.html

We execute:

curl -D- -u xxxx:xxxx -X POST -H "X-Atlassian-Token: nocheck" -F "file=@/text.txt" https://xxxx/rest/api/2/issue/ITA-999/attachments

We are getting the below response, and not seeing the attachment added when looking through the web UI.

 

HTTP/1.1 301 Moved Permanently

Content-Length: 0 

Location: https://xxxxx.xx.xx.io/jirarest/api/2/issue/ITA-999/attachments

What am I missing?

1 answer

0 votes
Evgenii
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 20, 2025

Hi, @joseph daniels 

Welcome to Atlassian Community.

You're using wrong request. You wrote nocheck, but must be no-check
And file you entered like @/text.txt, in example is another format

Example from KB article:

curl -D- -u admin:admin -X POST -H "X-Atlassian-Token: no-check" -F "file=@myfile.txt" http://myhost/rest/api/2/issue/TEST-123/attachments

 

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
9.17.0
TAGS
AUG Leaders

Atlassian Community Events