I was originally using Jenkins plugin (Jenkins JIRA Pipeline Steps) to integrate Jenkins with Jira. Unfortunately, I am unable to successfully download the attachment(s) to my Jenkins worker node. Debugging this further, I attempted to use curl to GET the attachment: curl -L -O -k -u 'adrianj@ibm.com:<myToken' -X GET http://<myhost>/secure/attachment/3454761/test.txt. The file downloads, but the contents of the file is invalid and reference a 403 forbidden message:
<body id="jira" class="aui-layout aui-style-default page-type-message " data-version="8.13.9" > <div class="aui-page-panel" ><div class="aui-page-panel-inner"> <main role="main" id="main" class="aui-page-panel-content" > <div class="aui-page-header" ><div class="aui-page-header-inner"> <div class="aui-page-header-main" > <h1>Forbidden (403)</h1> </div> </div></div> <div class="aui-message aui-message-warning warning"> <p>Encountered a <code>"403 - Forbidden"</code> error while loading this page.</p> <p>Basic Auth with password is disabled by the API Token Authentication app</p> <p><a href="/secure/MyJiraHome.jspa">Go to Jira home</a></p> </div> </main> </div></div> </body>
Are there in proven solutions in place to download Jira attachments?
You got 403 and it says to you:
Basic Auth with password is disabled by the API Token Authentication app
Means you have authentication problem
Thanks @Nir Haimov . Yes I saw that, which has led me down the path of using cookies. I have a solution in curl, by creating the cookie:
curl -c /path/to/some/folder/cookie-jar.txt -u username:apitoken https://<jira-url>/rest/api/2/issue/<issueIdOrKey>?fields=attachment
and then using it
curl -b /path/to/some/folder/cookie-jar.txt "https://<jira-url>/secure/attachment/10100/portallog.jpg" --output /path/to/some/folder/portallog.jpg
Source of reference: https://wiki.resolution.de/doc/api-token-authentication/latest/user-guide/knowledge-base/using-api-tokens-to-download-attachments
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So all is good?
You managed to achieve your final goal? :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.