Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Duplicate a project by rest api, Does not update project lead

Daniel Rojas
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!
May 13, 2022
I try to create a project based on another of my projects (<<myprojectid>>). Code below works, but it doesn´t update the Project Lead (leadAccountId). Any thought?
------------------------------------------------------------------------------------------------
function createProject(){

 

var IssueURL = "https://xxxxxxxxxx.atlassian.net/rest/api/3/project/<<myprojectid>>";
var apikey = "xxxxxxxxxxxx";
var login = "xxxxxxx@xxxxxx.com";
var UserCredentials = "Basic " + Utilities.base64Encode(login + ":" + apikey);



var Data = {"key":"NEWPRJ11","name":"Test Project created with shared configuration with T<<myprojectid>>", "leadAccountId":"NNNxNNNNNNxNNNNNNxxNxNNx"} ;

 

var payload = JSON.stringify(Data);

 

var headers = {"Accept":"application/json",
"Content-Type":"application/json",
"Authorization"UserCredentials,
"muteHttpExceptions""True",
};

 

var options = {"method":"POST",
"headers"headers,
"payload" : payload,
};

 

var response = UrlFetchApp.fetch(IssueURLoptions);

 

var dataAll = JSON.parse(response.getContentText());
var issueKey = dataAll.key;
Logger.log (issueKey);
}

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events