It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage
Highlighted

Need some help with API

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

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

Warren Community Leader Sep 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

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

Warren Community Leader Sep 10, 2019

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

I give you that ;-)

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

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...

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

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you