Forums

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

Change Project Template Key with Jira REST API

Fabian
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!
February 7, 2020

I'm currently using the following Endpoint to create a Project in Jira Software:

/rest/project-templates/1.0/createshared/{{projectid}}

and this does create the project, but unfortunately, it assigns the incorrect project template to the specific Project. I need to assign 'Scrum Classic' to ALL projects created on Jira.

Heres what I've tried:

{
"description": "Example Project description",
"url": "{{my-url}}",
"avatarId": 10200,
"name": "Example",
"assigneeType": "PROJECT_LEAD",
"projectTypeKey": "software",
"key":"NEW1","name":"Test Project created with correct template",
"lead":"First Name",
"projectTemplateKey": "com.pyxis.greenhopper.jira:gh-scrum-template"
}
 

 but it seems to ignore the projectTemplateKey for this Endpoint.

I have seen a solution online for creation of the project, but none for applying the project template.

https://jira.atlassian.com/browse/JRASERVER-27256?focusedCommentId=943621&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-943621

by https://jira.atlassian.com/secure/ViewProfile.jspa?name=korolev_ap

Just wondering if anyone has come across this issue.

Thanks in advance.

1 answer

0 votes
Vishal Kharde June 9, 2020

The endpoint which you had used doesn't have the projectTemplateKey as a allowed parameter. It accepts only 3 parameters, viz., lead, key and name

You can use the officially documented Create project REST API .

Rest endpoint: POST /rest/api/2/project

It has a projectTemplateKey parameter where you can specify the project template to be used. 

Sample Request payload:

{
"key": "EX",
"name": "Example",
"projectTypeKey": "business",
"projectTemplateKey": "com.atlassian.jira-core-project-templates:jira-core-project-management",
"description": "Example Project description",
"lead": "Charlie",
"url": "http://atlassian.com",
"assigneeType": "PROJECT_LEAD",
"avatarId": 10200,
"issueSecurityScheme": 10001,
"permissionScheme": 10011,
"notificationScheme": 10021,
"workflowSchemeId": 10031,
"categoryId": 10120
}

Some Valid values for projectTemplateKey(try the bold ones for your case),

  • com.pyxis.greenhopper.jira:gh-simplified-agility-kanban
  • com.pyxis.greenhopper.jira:gh-simplified-agility-scrum
  • com.pyxis.greenhopper.jira:gh-simplified-scrum-classic
  • com.pyxis.greenhopper.jira:gh-scrum-template
  • com.pyxis.greenhopper.jira:gh-simplified-basic
  • com.pyxis.greenhopper.jira:gh-simplified-kanban-classic
  • com.pyxis.greenhopper.jira:gh-kanban-template
  • com.pyxis.greenhopper.jira:basic-software-development-template
Deleted user March 10, 2021

@Vishal Kharde Do you know if there's a way to specify a custom projectTemplateKey, as opposed to the out-of-the-box JIRA templates?  Thanks!

Like Ferry van den Boom likes this

Suggest an answer

Log in or Sign up to answer