Getting authorization from Jira and How to extract total issues into excel file. Edited

Hiii. After running this coding, I still did not get authorization from Jira . Any solution to fix this problem? 

In addition, how to exceed the maxResult 50 by displaying the total issues into excel sheet?

Sub Extract_Jira_Data()

Call testAuthen

End Sub

Public Function UserPassBase64() As String

Dim objXML As Variant
Dim objNode As MSXML2.IXMLDOMElement
Dim arrData() As Byte
Dim UserNameP As String

UserNameP = "userName:password"
arrData = StrConv(UserNameP, vbFromUnicode)

Set objXML = CreateObject("MSXML2.DOMDocument")
Set objNode = objXML.createElement("b64")
objNode.DataType = "bin.base64"
objNode.nodeTypedValue = arrData

UserPassBase64 = objNode.text

End Function
Public Sub testAuthen()

Set ws = ThisWorkbook

Dim userName, password As String

userName = ActiveSheet.OLEObjects("txtUserNameIn").Object.text
password = ActiveSheet.OLEObjects("txtPasswordIn").Object.text

Dim JiraService As New MSXML2.XMLHTTP60
UserNameP = UserPassBase64

With JiraService
.Open "GET", query
.setRequestHeader "Content-Type", "application/json"
.setRequestHeader "Accept", "application/json"
.setRequestHeader "Authorization", "Basic " & UserNameP
.send ""

MsgBox .Status
If .Status = "401" Then
MsgBox "Not authorized or invalid username/password"
MsgBox "Correct credential!!"
End If

Set ws = ThisWorkbook

Dim Json As Object
Dim j As Integer
'Dim i As Integer
Set Json = JsonConverter.ParseJson(.responseText)

j = 2
For j = j To 50

'C3 Num
ActiveSheet.Cells(j, 1) = Json("issues")(j)("fields")("customfield_10400")

'Issue ID
ActiveSheet.Cells(j, 2) = Json("issues")(j)("key")
Next j
End With

End Sub

1 answer

0 vote
Warren Levy Community Champion Aug 25, 2017


The Username field must be the e-mail address that is used to login to Jira, not the username.

For the maxResult, it is determined by what your personal setting is. Click on your icon in the top right hand corner and choose Profile, then scroll down to the Preferences section. You'll see below that I have my Page size set to 200, which allows me to get 200 items at a time. click on the Edit icon (pen) to change yours



i tried to use both username and email address to log in but under the usernameP, it read a range of text that not match to what i had insert in the textbox.



Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

70 views 0 5
Read article

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