Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Impossible to add attachements to Jira issues via API

Antoine _Klee Group_
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.
December 20, 2023

Hello,
I am trying to upload an attachment to a Jira issue using the REST API using a third party tool, as the server documentation does not provide the method to perform this action, I used the cloud method which works fine on a separate instance.
https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-attachments/#api-rest-api-2-issue-issueidorkey-attachments-post

I receive a 200 response but an empty json.

Here is the sent HTTP request:

POST
https://myserverinstance/rest/api/2/issue/CN105TC-307/attachments
HTTPS/1.1
Authorization: Basic amlyYWl2YWxxxxxxxxxxxxxxxx
Accept: application/json
X-Atlassian-Token: no-check
Content-Type: multipart/form-data; boundary=---------------------------8dc01469ad1d7bf
Host: myserverinstance
Content-Length: 243881
Expect: 100-continue
Accept-Encoding: gzip, deflate


-----------------------------8dc01469ad1d7bf
Content-Disposition: form-data; name="VPN.png"; filename="VPN.png"
Content-Type: image/png

< binary_file>
-----------------------------8dc01469ad1d7bf--


AND the response from Jira.

HTTPS/1.1 200 OK
X-AREQUESTID: 689x48707x1
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Content-Security-Policy: frame-ancestors 'self'
X-ASEN: SEN-15xxxxx
X-Seraph-LoginReason: OK
X-ASESSIONID: 83kv3d
X-AUSERNAME: myuser
Content-Encoding:
Vary: User-Agent
Cache-Control: no-cache, no-store, no-transform
Content-Type: application/json;charset=UTF-8
Date: Wed, 20 Dec 2023 10:29:12 GMT
Server: Apache/2.4.39 (Win64) OpenSSL/1.1.1b
Transfer-Encoding: chunked

[]

Of course the attachment does not upload on the issue.

What could be the cause of the attachment not uploading and of that weird response?

Best.

1 answer

0 votes
Tansu Akdeniz
Community Champion
December 20, 2023
Antoine _Klee Group_
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.
December 20, 2023

Thanks, that is exactly what I am using but the response is empty

Suggest an answer

Log in or Sign up to answer