Issue with the API to add attachments

Pranita Warik March 1, 2022

As per the link, I have created a postman request for adding attachment in existing issue.
https://confluence.atlassian.com/jirakb/how-to-add-an-attachment-to-a-jira-issue-using-rest-api-699957734.html

I am getting a 200 response but the Response body only shows: []
There is no attachment in the issue in JIRA.
The body header and authorization of Post requests are same as mentioned in screenshot in above link.
I have tried with both issue id as well as Issue key
https://172.25.210.203:8443/rest/api/2/issue/67189/attachments
https://172.25.210.203:8443/rest/api/2/issue/DOWN-9/attachments

1 answer

0 votes
omoeller
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!
March 23, 2022

I had the same issue with status code 200 and only received an empty array.

I had to add the --form 'file=@"/home/user/myfile.txt"'

curl --location --request POST 'https://your-org.atlassian.net/rest/api/3/issue/${ISSUE-KEY}/attachments' \
--header 'X-Atlassian-Token: no-check' \
--header 'Accept: application/json' \
--header 'Content-Type: multipart/form-data' \
--header 'Authorization: Basic blabla' \
--form 'file=@"/home/user/myfile.txt"'

this is my postman:Bildschirmfoto vom 2022-03-23 16-26-32.pngBildschirmfoto vom 2022-03-23 16-26-53.png



Suggest an answer

Log in or Sign up to answer