Forums

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

How to call https://unity-central.atlassian.net/rest/api/2/issue/createmeta from VBA.

rahul_var
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!
September 16, 2020

Public Function makeJiraCall(ByVal resourceUrl As String, ByVal strUserLogin As String, ByVal strAPIToken As String) As String

Dim xmlhttp As New MSXML2.XMLHTTP60

xmlhttp.Open "Get", resourceUrl, False
xmlhttp.setRequestHeader "Accept", "application/json"
xmlhttp.setRequestHeader "Content-Type", "application/json"


Dim encodedauth As String
encodedauth = EncodeBase64(strUserLogin & ":" & strAPIToken)

xmlhttp.setRequestHeader "Authorization", "Basic " & encodedauth

xmlhttp.send

MsgBox xmlhttp.Status


makeJiraCall = xmlhttp.responseText

End Function

What is wrong in this code??

When I use pythong, i get data in Response, but above call from vba gives me following:

{"expand":"projects","projects":[]}

 

1 answer

0 votes
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 17, 2020

HI Rahul,

I see that you are using VBA in order to try to make a REST API call to a Jira Cloud site.  I suspect that what is happening here is that VBA is doing something differently here when it comes to base64 encoding your string than is done via python.

If the authorization was incorrectly passed here, it could explain why Jira would respond this way.  That endpoint is open even to anonymous calls, but you will certainly get back different results when authenticated vs when anonymous.

However I am not sure what the correct syntax for doing this in VBA.  Take a look at our page in Basic auth for REST APIs.  We have noted that in some systems, like Windows, using powershell has to make sure that we are taking these strings in as a UTF8 encoding before it is encoded.  Otherwise the encoding ends up differently many times.  I have also come across cases where the base64 encoding can include a carriage return unexpectedly, like in this thread.

It might be worth just trying to get your script to echo out what the base64 encoded string is here.  That might be one way to then compare that against what is expected to be when following our guide.  If the encoded strings are different here then we can at least know that is the problem here.

Andy

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events