I am automating our release process by integrating our build software to update the transition in JIRA system.
I am using C# widows application with JIRA SDK. I am able to update every other fields but transition.
So I tried updating transition with Postman by posting below code through APIs:
{
"update": {
"comment": [
{
"add": {
"body": "This is included in XX.06 Version."
}
}
]
},
"transition": {
"id": "211"
}
}
But no luck.
I am using windows app with C#.
Could anyone help me out.
Thanks in advance.
Sorry to ask a dumb question, but does the user you're authenticating as have project_admin scope? It appears from the doco you have to have that to make transition changes to an issue, but you can create the issue with just the create scope just not transition it.
I will comment that I'm fighting with a similar problem at the moment, so I could well be wrong.
The transition may be commited under the conditions:
1. You have transition from the current status to the planned.
2. You have to fill all required fields on transition screen.
3. All validators have been passed.
So check that you a really have transition "id": "211" from the current status, all required fields have been filled and all validators have been passed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gregor,
Thanks for your response.
I tried updating all the fields and also my transition id is correct. And validators are passed.
Still i got the same error.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kamal
When I transition an issue, the JSON looks like this
{
"update": {},
"transition": {
"id": "241"
},
"fields": {
"resolution": {
"name": "Done"
}
}
}
So it's the resolution section which is different - try adding that
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your reply Warren.
I added the code what you suggested and tried posting using 'Postman'. With 'no authentication' as well as 'Basic Authentication',
In both the case i am getting 'Unauthorized 401' error.
Could you please guide me step by step or any link where i can get these details.
Thanks in advance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You need to provide authenications data in the header. You should add to the header Authorization parameter with value "Basic <encodedBase64String>"
encodedBase64String= Base64.encode("username:password").
Read more here about it
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Alexey,
Thanks for your response.
I tried the way you have suggested but still i am getting same 'Unauthorized 401' error.
Here is code snippet i am trying to run from my app using C#.
var client = new RestClient("http://jira2.test.com/rest/api/2/issue/test/transitions");
var request = new RestRequest(Method.POST);
request.AddHeader("postman-token", "864f9baf-c18b-7eeb-6329-b36e8c5cf726");
request.AddHeader("cache-control", "no-cache");
request.AddHeader("Authorization", "Basic dGVzdDp0ZXN0");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "\r\n{\r\n \"update\": {},\r\n \"transition\": {\r\n \"id\": \"211\"\r\n },\r\n \"fields\": {\r\n \"resolution\": {\r\n \"name\": \"Done\"\r\n }\r\n }\r\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
I am getting following response in body section:
<body id="jira" class="aui-layout aui-style-default page-type-message" data-version="7.1.1" >
<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>
Any idea why its happening?
I am able to change the transition manually in JIRA site. So there is no question of authorization. Something else i am missing in this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I forgot to ask. Do you use basic authentication in Jira? Sorry, I had to begin with the question.
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.
Could you execute a simpler script
var client = new RestClient("http://jira2.test.com/rest/rest/api/2/project");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Basic dGVzdDp0ZXN0");
request.AddHeader("content-type", "application/json");
IRestResponse response = client.Execute(request);
Your response must return information about projects
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.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.