Jira Version -- Jira v9.6.0
I am trying to download an attachment using the below curl command
curl -k --header 'Authorization: Bearer <API TOKEN>' https://<host:port>/secure/attachment/161500/RiasDataDump_2022-11-02_10_59_15.zip --output /path/filename.zip
When checking using curl in verbose, I could see the below error. I am using an API token. PAT is disabled.
* Mark bundle as not supporting multiuse
< HTTP/1.1 302
< X-AREQUESTID: 360x20550x1
< Referrer-Policy: strict-origin-when-cross-origin
< X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
< Content-Security-Policy: frame-ancestors 'self'
< Strict-Transport-Security: max-age=31536000
< Set-Cookie: atlassian.xsrf.token=BGAS-FQ5Y-WA7O-P1CH_0b907bdaf280eab8aae0f9720d36bf9e3b51ecf0_lout; Path=/; Secure; SameSite=None
< X-AUSERNAME: anonymous
< Location: /login.jsp?permissionViolation=true&os_destination=%2Fsecure%2Fattachment%2F161500%2FRiasDataDump_2022-11-02_10_59_15.zip&page_caps=&user_role=
< Content-Type: text/html;charset=UTF-8
< Content-Length: 0
< Date: Sat, 25 Feb 2023 12:00:14 GMT
I have set up a local Jira instance, where I am able to download attachments using this format.
I have tried some other curl and wget options as well, but nothing has worked so far.
wget -d --header="X-Auth-Token: Authorization Bearer <API Token>" --header="X-AUSERNAME: <Userid>" "https://<host:port>/secure/attachment/161500/RiasDataDump_2022-11-02_10_59_15.zip" --no-check-certificate
curl "https://<host:port>/secure/attachment/161500/RiasDataDump_2022-11-02_10_59_15.zip" -u "Authorization Bearer <user email address>:<token>" -o /path/filename
I can download attachments from the browser. With the API token, I am able to create Tasks, update Task Status, and add comments.