I previously used the API to add comments to JIRA issues from a VB6 IDE add-in. Then it stopped working. Now we need it to work again. I found this suggested cURL command but the response is Unauthorized (401). Here's the command that I call from a batch file:
C:\tools\curl\bin\curl -k -u "MyName:MyPassword" -X POST "https://itvision.atlassian.net/rest/api/3/issue/SYN-11/comment" -H "Content-Type: application.json" --data "This is a test. Please ignore it. Thanks."
The SYN-11 JIRA issue exists.
I directed the command output to a text file. It seems to be HTML that says unauthorized. I was going to attach the file but there's no attach button for a file only link or image. So the file is at the bottom of this detail.
When I redirected the output I got additional output to the command window that said:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 23395 0 23354 100 41 27410 48 --:--:-- --:--:-- --:--:-- 27426
That doesn't look great. In the window it looked columnar.
So, the MyName:MyPassword are where I have my name and my password to log into the company's Atlassian cloud. I logged out to prove that my name and password worked - they did. So what is wrong when I try the API REST call?
Thanks
Jef.
Output file content below:
<html>
<head>
<title>Unauthorized (401)</title>
<!--[if IE]><![endif]-->
<script type="text/javascript" >
var contextPath = '';
var DeferScripts = { deferState: 'disabled' };
</script>
***************
Large section of script cut out from here to make request fit constraints
***************
<div> <script type="text/javascript" crossorigin="anonymous" data-encoding="gzip" src="https://jira-frontend-prod-ap-1.ap-southeast-2.prod.public.atl-paas.net/assets/language-pack.en_UK.b76495a9cf2d362e896b.7.js"></script> </div>
<meta name="application-name" content="JIRA" data-name="jira" data-version="1001.0.0-SNAPSHOT">
</head>
<body id="jira" class="aui-layout aui-style-default page-type-message" data-version="1001.0.0-SNAPSHOT" >
<div class="aui-page-panel"><div class="aui-page-panel-inner">
<section class="aui-page-panel-content">
<header class="aui-page-header"><div class="aui-page-header-inner">
<div class="aui-page-header-main">
<h1>Unauthorized (401)</h1>
</div><!-- .aui-page-header-main -->
</div><!-- .aui-page-header-inner --></header><!-- .aui-page-header -->
<div class="aui-message aui-message-warning warning">
<p>Encountered a <code>"401 - Unauthorized"</code> error while loading this page.</p>
<p><a href="/secure/MyJiraHome.jspa">Go to Jira home</a></p>
</div>
</section><!-- .aui-page-panel-content -->
</div><!-- .aui-page-panel-inner --></div><!-- .aui-page-panel -->
</body>
</html>