JIRA Transition using VBA

Hi,

I am trying to create an excel macro which will automatically transition the status of JIRA's as per user input in the excel sheet.

We are using JIRA 4.4.5 version. Could anyone please help me out with some code snippets or formats for the post query (for VBA) that i can use to achieve my goal.

I googled a bit and found that i can access available JIRA transition states using the below code:


Private JiraService As New MSXML2.XMLHTTP60
Private JiraAuth As New MSXML2.XMLHTTP60

1. Create the "Cookie"/ session:

With JiraAuth
.Open "POST", "https://YourJIRAAddress/jira/rest/auth/1/session", False
.setRequestHeader "Content-Type", "application/json"
.setRequestHeader "Accept", "application/json"
.send " {""username"" : ""user"", ""password"" : ""passwort""}"""
sErg = .responseText
sCookie = "JSESSIONID=" & Mid(sErg, 42, 32) & "; Path=/Jira" '*** Extract the Session-ID
End With

2. Get the issue (here TEST-150):

With JiraService
.Open "GET", "https://YourJIRAAddress/jira/rest/api/2.0.alpha1/issue/TEST-150/transition", False
.setRequestHeader "Content-Type", "application/json"
.setRequestHeader "Accept", "application/json"
.setRequestHeader "Set-Cookie", sCookie '*** see Create a "Cookie"

.send
sRestAntwort = .responseText
End With

Now, I want to post a transition change on the above JIRA. Please help with your inputs. Thank You.

2 answers

Hello Mathias,

Thank you for your reply. However, both the methods posted in the link above are using curl and java.

I am using VBA and these commands did not work there. I was wondering if I could send a POST request via WINHTTP for transitioning the status and if so, then the possible format of sending the POST request in. Thank you

Hi Sayan,

Did you get the solution for this via VBA to get the transition?

This widget could not be displayed.

Hello,

I am also attempting to connect, however I am using VBScript.  Java is not an option as this is for Quality Center and it uses VBScript to customize.

I'm trying to auth using basic.  below is my existing code, modified from @Sayan

 

Dim oXMLHTTP
Set oXMLHTTP = ObjectCreate("WinHttp.WinHttpRequest.5.1")
      
   oXMLHTTP.open "POST", "http://jira.myurl.com/jira/rest/auth/latest/session", false
   oXMLHTTP.setRequestHeader "Authorization", "Basic (Base64String)"
   oXMLHTTP.setRequestHeader "Content-Type", "application/json"
   oXMLHTTP.setRequestHeader "Accept", "application/json"
   oXMLHTTP.Send
   sErg = oXMLHTTP.response
   MsgBox "Results are: " & sErg
   Set sCookie = "JSESSIONID=" & Mid(sErg, 42, 32) & "; Path=/Jira"              '*** Extract the Session-ID
   MsgBox "Cookie: " & sCookie

 

I get back nothing in my Msgbox response, not even an error.  It seems strange, is there a way to build an authentication header through this method.

 

Thanks!

 

 

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted 9 hours ago in Teamwork

What teamwork quotes inspire you?

Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork?  We've compiled a list here, along with...

23 views 3 4
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you