Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Getting details of Jira issues using Rest API - VBA

karthikeyan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 4, 2018

Hi All,

 

Using below VBA code to get the details of an issue, i am able to connect to jira successfully with  oJiraAuth method.

But when i am trying to connect to particular issue using  oJiraService getting Error code 401 

Actually i am planning to get different issue details by passing the issue id through excel data sheet. so tried to pull the details of one issue using the below code.

Please let me know how to fix this issue.

 

  Dim oJiraAuth As MSXML2.ServerXMLHTTP60

  Dim oJiraService As MSXML2.ServerXMLHTTP60

  Set oJiraAuth = New MSXML2.ServerXMLHTTP60

  

  With oJiraAuth

     

      .Open "POST", "Myjira url/rest/auth/1/session", False

      .setRequestHeader "Content-Type", "application/json"

      .setRequestHeader "Accept", "application/json"

      .send " {""username"" :  ""karthi"" ,  ""password"" : ""password!""}"

       sOutput = .responseText

       sCookie = "JSESSIONID=" & Mid(sOutput, 42, 32) & ";Path=/Jira"

       status = .status

       stext = .statusText

      If status = 200 Then

       MsgBox "Connected to Jira successfully"

       Else

      MsgBox "Not connected to Jira"

      End If

      End With

 

  'MsgBox sCookie

  Set oJiraService = New MSXML2.ServerXMLHTTP60

 

  With oJiraService

        

         

       .Open "GET", "Myjiraurl/rest/api/2/issue/CPPMLA-1", False

       .setRequestHeader "Content-Type", "application/json"

       .setRequestHeader "Accept", "application/json"

       .setRequestHeader "Set-Cookie", sCookie '*** see Create a "Cookie"

        'MsgBox sCookie

        .send

        sRestAntwort = .responseText

         MsgBox " status " & .status

        End With

   Set oJiraAuth = Nothing

1 answer

0 votes
Esteban
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 17, 2019

same issue here. Connected succesfully but using the Service returns 401

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events