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
Community Members
Community Events
Community Groups

Create project via REST api and copy workflow

Hi guys,


im trying to find a way to create projects via the REST api.

i've found the usual: rest/api/2/project PUBLIC api.


Sadly i can't find a solution to copy the workflow of another project to also use it for the new project

I've seen some old comments from 2016 that the rest api doesnt support this function, is it still that case ?


Has anybody found a workaround?

Has somebody done this with another api already or with scriptrunner?

3 answers

1 accepted

0 votes
Answer accepted
Antoine Berry Community Leader Apr 12, 2019

Hi @Marvin Schmidtke ,

Talking about scriptrunner, I have not done it with workflows but with issue types. Looking at the documentation, something like : 

Project sourceProject = ComponentAccessor.getProjectManager().getProjectObjByKey("source-project");
Project targetProject = ComponentAccessor.getProjectManager().getProjectObjByKey("target-project");
def workflowSchemeManager = ComponentAccessor.getWorkflowSchemeManager()
def sourceWorkflowScheme = workflowSchemeManager.getWorkflowSchemeObj(sourceProject)

workflowSchemeManager.addSchemeToProject(targetProject, sourceWorkflowScheme)

could work.


Antoine Berry Community Leader Apr 16, 2019

Hi @Marvin Schmidtke ,

Did that help ?

I found that this answer has been asked and answered elsewhere.  Stackoverflow is awesome.

Anyway, I'll post my solution here.  First and foremost we assume that you know how to login and get websudo privileges.  It's needed.  Or this won't work.

2nd, I assume you know how to setup your own ApacheHttpClient or whatever you want to use.  So we won't go there.  And I assume you know how to serialize and deserialize objects to/from JSON.  

And, I'll apologize...I'm 60 years old and don't work with JSON.  I work with POJO's.  And lumbok and gson are my friends.  And, I am not going to post my 50 POJO's..  Assume all POJO's are JSON.


// This is the pid of MY template.  Not yours.  Change to your template
static final int TEMPLATE_ARTIFACT_SCRUM = 10457;

// Create a project creation request for use with the createshared API
template = new JiraProjectCreateTemplateRequest();

JiraProject jp = createProjectWithTemplate(template, TEMPLATE_ARTIFACT_SCRUM);
// create a project from a template or Shared Configuration project
JiraProject createProjectWithTemplate(JiraProjectCreateTemplateRequest request, int template) throws HttpRequestException {
String path = String.format("/rest/project-templates/1.0/createshared/%d", template);
JiraProjectCreateTemplateResponse response = post(path, request, JiraProjectCreateTemplateResponse.class);
if (response == null)
throw new HttpRequestException(HttpStatus.SC_INTERNAL_SERVER_ERROR, "Project not created");
return getProject(response.getProjectKey());

 The 'post' method in this function is my little wrapper to deserialize and serialize POJO's.  The POJO for the response is:

public class JiraProjectCreateTemplateResponse implements Serializable {

String returnUrl;
int projectId;
String projectKey;
String projectName;
JiraRemoteProjectLinks remoteProjectLinks;

 In the end, this works for me because this is how I create projects in the GUI anyway.


I cannot find the answer either.  

There is the REST api using the com.pyxis.greenhopper.jira:gh-scrum-template default template as the projectTemplateKey.

But, doesn't appear that you can specify anything else.

So, I'm abandoning the REST API and will simply use the form POST as done from the GUI.

I've just decided to do this.  So, if you found another answer, let me know.  Else, I'll post my final code once I get it working (need to dive into Javascript...)

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Apps & Integrations

Marketplace Partner Spotlight: AppLiger

This month the spotlight is on AppLiger. We caught up with Pavel Pavlovsky, CEO and Product Manager, to learn how the company started and what fuels the team's creativity.    Atlassian:...

369 views 0 7
Read article

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