Forums

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

Jira Rest API Authentication issue via VBA

Arun July 13, 2018


I'm using below vba code to access jira rest api. When I try it manually after logging in through ie browser i'm able to get json response as below. But via vba code I'm getting error like

"The server name or Address could not be resolved"

Also while accessing jira url through ie for first time it requires to pass the credentials in my organization login page. will this code use the credentials which we are passing in code to login to this page(Mainly asking because it is my organization login page)?? Please help me in overcome this issue. Thanks in Advance!!!

 

JSON response:

{"self":"https://myurl/issues2/rest/api/latest/user?username=xxx","name":"xxx","loginInfo":{"loginCount":24,"previousLoginTime":"2018-07-13T04:52:47.821-0400"}}

 

VBA code:

## myurl,user,JIRA_PWD fields has to be modified while running the code

Dim oJiraAuth As MSXML2.ServerXMLHTTP60
Dim oJiraService As MSXML2.ServerXMLHTTP60
Set oJiraAuth = New MSXML2.ServerXMLHTTP60
With oJiraAuth
.Open "POST", "https://myurl/issues2/rest/auth/1/session", False
.setRequestHeader "Content-Type", "application/json"
.setRequestHeader "Accept", "application/json"
.send " {""username"" : """ & USER & """, ""password"" : """ & JIRA_PWD & """}"
sOutput = .responseText
sCookie = "JSESSIONID=" & Mid(sOutput, 42, 32) & "; Path=/Jira"
End With

2 answers

0 votes
Markus Sarembe
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 22, 2023

Does anyone know how to use JIRA Personal Access Token in VBA for authorisation instead of user & password? Thanks in advance

0 votes
Sedera Randria
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 29, 2021

Just curious about this old question.

Currently, I connect manually to the VPN, then I launch my script. 

Suggest an answer

Log in or Sign up to answer