Google Code to connect Google Sheet with JIRA API KEY

ERIK GAUDIN October 2, 2019

 

Greeting, I was using "mylittleblue" script to push GSheet information into a Jira Ticket, but since July 2019, this methoud are in "phase out". How can i convert this method to the new API KEY method ?  (here bellow what i'm using)

 

 

 

var username = "myemailadress@mydomain.ca"
var password = "pw"
var CloudIdKey = "myapikeygeneratedfromjira"
var UserCredentials = username + ":" + CloudIdKey;
var headers =
{
"content-type": "application/json",
"Accept": "application/json",
"authorization": UserCredentials
};

//
// A final few options to complete the JSON string
//
var options =
{
"content-type": "application/json",
"method": "POST",
"headers": headers,
"payload": payload
};

//
// Make the HTTP call to the JIRA API
//
var response = UrlFetchApp.fetch(url, options);
Logger.log(response.getContentText());
//

1 answer

1 accepted

1 vote
Answer accepted
Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 8, 2019

Hi @ERIK GAUDIN ,

As written in the Deprecation of basic authentication with passwords for Jira and Confluence APIs:

Atlassian Cloud sites have introduced support for API tokens to replace Atlassian account passwords for all Jira and Confluence APIs.

In other words: Basic Authentication with username and password has been replaced by Baisc authentication with email address and API tokens.

 

Therefore, it is just enough to replace the username with the email address and the password with an API token in your script in order to have it working as before.

 

For further details please see:

 

 

Cheers,
Dario

ERIK GAUDIN August 5, 2020

I was using a GForm.. that filles a GSheet (and the script start each time the GFrom task done).

 

On the Jira site, i was using a generic user (i called it "service user") to create the task. This part still working fine. But, in order to add the requester to the Jira task (so he can follow the task), i was using the e-mail adresses to fetch the JIRA ID, and then put the user as "watcher" or "requester" on the Jira Ticket.

That part not working anymore since the new API.

 

As i collect all e-mail adress during the GForm process, it was the easiest solution to assigned ticket. How can i acheive this now ?

Suggest an answer

Log in or Sign up to answer