Is it possible to create project from project template through java api?

Hey guys,

Looking into the Java API, I can’t find a way to create a project from an existing template through the Java API. Am I missing something from the docs?

Thanks

probably need to do a get on an existing project and a post to create a new one. or roll your own endpoint. there used to be a groovy script to clone a repo. was probably merged into scriptrunner a million years ago.

Hello Diego,

Are you looking for something like this ?

// Set data for project creation
ProjectCreationData.Builder builder = new ProjectCreationData.Builder();
			
ProjectCreationData projectCreationData = builder
					.withName(name)
					.withKey(key)
					.withProjectTemplateKey(existing_template_key) 
					.withType("software")
					.withLead(projectLead)
					.build();
			
// Validate data
CreateProjectValidationResult validation = projectService.validateCreateProject(caller,projectCreationData);

// Check for errors...

// Creation of the jira project
Project project = projectService.createProject(validation);

Hope this helps!

Lorie

2 Likes