Accessing JIRA OnDemand via REST from either curl or Google Apps

Dave Hannon July 14, 2014

I would like to access the worklogs for our JIRA OnDemand instance from within Google Apps via UrlFetchApp.fetch().

In order to start, I was attempting to use curl using basic auth from the command line to prove I can access it. I used this example as my guide: https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+Example+-+Basic+Authentication

I attempted to use the form where I am passing the header info. My thought is that I can pass the header info via Google Apps UrlFetchApp.fetch() to do the same thing. I am using the form of the example of: -H "Authorization: Basic ZnJlZDpmcmVk", but with my proper info,

I am hitting the following URL: https://((ourinstance)).atlassian.net/rest/api/2/search?fields=id,self,key,summary,issuetype,timespent,reporter,created,updated,priority,status,labels,creator,assignee,versions,aggregatetimespent,worklog&jql=project= FAST AND updated >= 2014-07-06 AND updated <= 2014-07-19

When I do so, I get a 401 Unauthorized in return. I can successfully use that URL in my browser to get JSON back with the data I seek.

The account I am using is setup to allow Google Apps for login. I also reset the password, so I could use basic auth. I am able to login and out using both.

Is what I am attempting possible in OnDemand? What am I missing?

Thanks.

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Dave
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 28, 2014

Hi Dave,

The problem might be that the user authentication for Google is distinct from that in JIRA. The first time you authenticate with Google you are asked to create a password for JIRA, which is the local passwored stored in the JIRA DB. This means that using the API, you need to authenticate with that local user/password and not your Google credentials - is that what you're doing with curl?

Cheers,

-dave

Viet Nguyen January 25, 2015

Hi @David Nicholson [Atlassian], do you know if using google credentials to access the APIs will be supported soon? Most of the people I've talked to who have Google auth to JIRA opted to not create a password and only use SSO with Google Auth. So it is impossible for those people to use the REST apis, without asking an admin to set them a temporary password.

Dave
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 25, 2015

I'm not aware of any plans, but any user can change their own password from the forgot password link on the login page - this will not affect their Google password or authentication at all.

TAGS
AUG Leaders

Atlassian Community Events