How to upload zip attachment to issue using REST API?

1.1k Views Asked by At

i'm trying now to upload zip attachment through REST API but no success. It works, when I'm trying to attach picture, but when I use the same command for zip

curl -D- -u Bogdan:Password -X POST -H "X-Atlassian-Token: nocheck" -F "[email protected]" http://localhost:5555/rest/api/2/issue/XA-1/attachments

I have such response:

HTTP/1.1 100 Continue HTTP/1.1 404 Not Found Server: Apache-Coyote/1.1 X-AREQUESTID: 1352x1015x1 X-ASEN: SEN-2117746 Set-Cookie: JSESSIONID=97A763E5E09F7F8476CEDF07A2ACD7C6; Path=/; HttpOnly X-Seraph-LoginReason: OK Set-Cookie: atlassian.xsrf.token=B7X0-QLNV-RIK8-C6T9|aca131a97f4fdb61cebd0bfb6681c66824d62464|lin; Path=/ X-ASESSIONID: nzll4r X-AUSERNAME: Bogdan Cache-Control: no-cache, no-store, no-transform X-Content-Type-Options: nosniff Content-Type: application/json;charset=UTF-8 Transfer-Encoding: chunked Date: Thu, 20 Nov 2014 21:32:11 GMT

When I modified and explicitly said content type that it is zip

url -D- -u Bogdan:Password -X POST -H "Content-Type: application/zip" -H "X-Atlassian-Token: nocheck" -F "[email protected]" http://localhost:5555/rest/api/2/issue/XA-1/attachments

I got an "Unsupported Media Type" response:

HTTP/1.1 100 Continue HTTP/1.1 415 Unsupported Media Type Server: Apache-Coyote/1.1 X-AREQUESTID: 1353x1016x1 X-ASEN: SEN-2117746 Set-Cookie: JSESSIONID=6225FF25F6D71BADB6890C9F448608B6; Path=/; HttpOnly X-Seraph-LoginReason: OK Set-Cookie: atlassian.xsrf.token=B7X0-QLNV-RIK8-C6T9|e2c7fc222c74c37f5080150df1cd865eaa8daf7e|lin; Path=/ X-ASESSIONID: 1lbjx70 X-AUSERNAME: Bogdan X-Content-Type-Options: nosniff Content-Type: text/html;charset=utf-8 Content-Language: en Content-Length: 1092 Date: Thu, 20 Nov 2014 21:33:07 GMT

Is it possible actually to upload archives via REST Api?

1

There are 1 best solutions below

0
On

Actually the problem was that the file was too big for download, the limit is 10 Mb, and I was trying to upload more than it.

Quite sad that looking at this documentation https://docs.atlassian.com/jira/REST/latest/#d2e4527 there is no information about 404, when it can happen. And no information how you can guess the real cause