Need some help with API

Pravin September 9, 2019

Hi,

I have a VBA macro (code shown below). When I run the macro, it keeps giving me authentication error (shown below). I dont know how to provide authentication details in this code now, can you help?

I do get results back when I run the URL from browser.

URL - http://localhost:8080/rest/api/2/issue/TPP-1?fields=summary

Please suggest how to get this working?

 

VBA Code:

Sub Button2_Click()

Set MyRequest = CreateObject("WinHttp.WinHttpRequest.5.1")
MyRequest.Open "GET", "http://localhost:8080/rest/api/2/issue/TPP-1?fields=summary"
MyRequest.Send
MsgBox MyRequest.ResponseText

End Sub

 

Error:

{"errorMessages":["You do not have the permission to see the specified issue.","Login Required"],"errors":{}}

 

 

4 comments

Pravin September 9, 2019

I added authentication details to the URL, but still same error:

 

Sub Button2_Click()

Set MyRequest = CreateObject("WinHttp.WinHttpRequest.5.1")
MyRequest.Open "GET", "http://localhost:8080/rest/api/2/issue/TPP-1?fields=summary?os_username=psp;os_password=pwd"
MyRequest.Send
MsgBox MyRequest.ResponseText

End Sub

Tomas Gustavsson
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 9, 2019
Warren
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 10, 2019

Hi @Pravin 

Your main problem is that you shouldn't be using a password for authentication - it changed a couple of months ago - see this.

You should be using your Jira e-mail address and an API token generated with that same e-mail address.

If that still doesn't work, get back here and tell us what error you're receiving

Tomas Gustavsson
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 10, 2019

That's only for cloud, is'n it?

Warren
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 10, 2019

Yes it is, although nowhere on this page is it stated whether the question relates to cloud or server

Tomas Gustavsson
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 10, 2019

I give you that ;-)

Pravin September 10, 2019

Sorry I should have mentioned that this is Jira Server install (http://localhost:8080)

Pravin September 10, 2019

Is there any ready code that I can reuse (with modifications) for pulling data from Jira server into Excel?

Getting tired of authentication errors and not able to get things working...

Pravin September 10, 2019

Please refer to the attached screenshot for the code that I was able to generate (thankyou Google :)-)

Even though my credentials are correct, I keep getting "Not Authorized" message.

Please suggest whats going wrong here...

UnAuthorized.JPG

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events