Heads up! On March 5, starting at 4:30 PM Central Time, our community will be undergoing scheduled maintenance for a few hours. During this time, you will find the site temporarily inaccessible. Thanks for your patience. Read more.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Using HTTP GET with Personal Access Token

Erin Leiker
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!
April 12, 2022

I have created a Jira PAT, and am able to use it successfully in Postman to get the results of a search filter. However, when I transfer this same GET to HTTP (for use in Microsoft Flow), I get this returned in the body and nothing else:

 

<html>
<head><title>302 Found</title></head>
<body>
<center><h1>302 Found</h1></center>
</body>
</html>

 

I'm not super familiar with PATs or HTTP GETs, but my Googling tells me there's some kind of authentication step I'm missing. I'm passing the PAT as a bearer token in the header as "Authorization" but nothing else. Can anyone help me figure out what I'm missing or doing wrong? Is it reasonable to expect to be able to do an HTTP GET with PATs?

Thank you all!

2 answers

1 accepted

2 votes
Answer accepted
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 14, 2022

Hey there. It sounds like your Jira instance is behind a firewall (you indicated it works over VPN). 

So you've probably correctly deduced the issue: 

it may not be possible to do this from outside our network via Microsoft Flow/PowerAutomate.

The only workaround would be if your IT/Networking team would be willing to open up the Jira ports to specific IP addresses used by your automations. There's details on this here:

Managed connectors outbound IP addresses 

1 vote
Esther Strom
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 12, 2022

Hi, @Erin Leiker - welcome to the Community!

It's been many years since I've worked in a server/data center environment, so I'm kind of rusty.

I did some quick googling of the Server REST API and how to use PATs, and I'm wondering if it's possible that when you generated your token, you set it to expire? If not, what response do you get if you try following the cURL example in the PAT documentation?

 

curl -H "Authorization: Bearer <yourToken>" https://{confluenceBaseUrl}/rest/api/content

 

If this is for testing purposes (i.e. not production code) you could also try basic authentication.

Erin Leiker
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!
April 12, 2022

Hi! I did not set the token to expire, no. When I run the cURL you posted nothing is returned, but when I change the URL and run this I get the response I expect (the filter contains one test ticket and I see that ticket's details), same as in Postman:

curl -H "Authorization: Bearer <myToken>" https://{myJiraBaseUrl}/rest/api/2/search?jql=filter={myFilterId}

 I suspect it's because our Jira instance uses a separate authentication process. When I'm connected to the company's network Postman (and that cURL) return what I expect, but when I'm disconnected from the VPN I get the same redirect HTML I posted originally. I'm thinking it may not be possible to do this from outside our network via Microsoft Flow/PowerAutomate.

Esther Strom
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 14, 2022

Hmm. That's beyond my experience after so many years. I'll see if I can find another community leader who has experience with this.

Like # people like this

Suggest an answer

Log in or Sign up to answer