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

Can fetch Jira API from Terminal, but fail via Google Apps Script

We run a self-hosted Jira-Environment and set up OAUth Access to use the REST API.

I am able to fetch any API Call via Terminal (cURL) but fail each time i will try to fetch via Google Apps Script.

I guess that there is only one simple little detail missing, but i cant find it. :(

 

This is my cURL Call:

curl -D- -X GET -H "Authorization: Basic BASE64encoded_username:passwd" -H "Content-Type: application/json" "https://JIRA-DOMAIN.de/rest/api/2/issue/ISSUE-ID"

 And this is how i would like to fetch it via Google Apps Script: 

function getAPIFeedback() {
  var header_options = {
'method':'get',
'headers':{
'Authorization':'Basic BASE64encoded_username:passwd',
'Content-Type':'application/json;charset=UTF-8'
}
};

try{
var response = UrlFetchApp.fetch('https://JIRA-DOMAIN.de/rest/api/2/issue/ISSUE-ID', header_options);
Logger.log(response);
}catch(err){Logger.log(err)}
}

Each time I get a 401 Error, and dont understand why.

 

I would be very happy if someone could help me.

Bet Regards, Michael 

2 answers

Any chance that there is a reverse proxy involved which requires additional authentication? ;-)

*hmm

Could be possible.
I will get in touch with my Admin and give it a try.

Thanks for your advice.

Same occurred to me.

It is fixed?

There is a workaround to solve it?

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

Demo Den Ep. 7: New Jira Cloud Reports

Learn how to use two new reports for next-gen projects in Jira Cloud:  Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...

245 views 1 2
Join discussion

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