Hello,
I would like to check if JIRA cloud REST API is suitable for download an attachment?
The Doc describes abilities to upload (POST) an attachment to issue, get its metadata but no download.
Is there is REST API for download?
Is it possible to download from client app without server and Jira-connect?
Hello @ErezAvny!
Both Get Issue and Get attachment metadata contain an attachment’s content field which is URL for this attachment.
All you have to do to download it is to make a GET request on this URL.
Example:
I’ve called the Get attachment metadata API and got this response
I try follow your guide but when I try to fetch the file with GET (inside the Jira cloud app) the response is redirect to login page and got http/https mismatch content.
The request redirect to: https://{my-domain}.atlassian.net/login.jsp?permissionViolation=true&os_destination=%2Fsecure%2Fattachment%2F{attachment-id}%2F{file-name}.json&page_caps=&user_role=
–
And got this error in network panel:
Access to fetch at 'https://{my-domain}.atlassian.net/login.jsp?permissionViolation=true&os_destination=%2Fsecure%2Fattachment%2F{attachment-id}%2F{file-name}.json&page_caps=&user_role=' (redirected from 'https://{my-domain}.atlassian.net/secure/attachment/{attachment-id}/{file-name}.json') from origin 'https://{tunnel-id}.ngrok.io' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.
I think you’re missing Authentication header. To make this kind of request you have to be authenticated to your Jira instance. You can do it by, for example, adding Basic Auth header to the request or calling API from authenticated Connect Application.
I am having a similar issue. I tried authenticating using Basic authentication which worked for me while getting the metadata for the attachments.
It is throwing a 400 response code to my GET request.
Let me know how I can get around this.
Hello, as mentioned @MaciejStanuch , you need to fetch the file content with authorization header (basic auth)
here’s below exp using postman
1- first get the attchment meta data