It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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?

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
TAGS
Community showcase
Published in Marketplace Apps & Integrations

Expose your beautifully crafted Dashboard through the Jira Service Desk Customer Portal

  A picture is worth a thousand words, especially when you're trying to find relationships and understand your data. Here, Dashboards play a vital role in gaining insights from a variety of dat...

365 views 5 4
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you