Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,295,419
Community Members
 
Community Events
165
Community Groups

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

Edited
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

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