0
votes

We are using Jira in our organization. I'm using Python and rest API/2 to connect with Jira (Server). I wanted to create a project with existing project configuration, I found it using rest API/1. Is there any way to do the same using version 2?

I already checked here:

I'm using requests module in Python.

How to get all the configurations that are made to the project (We will use the below configurations for templates in our organization)?

  • Issue Type Scheme
  • Workflow Scheme
  • Issue Type Screen Scheme
  • Field Configuration Scheme
  • Permission Scheme
  • Notification Scheme
  • Issue Security
1

1 Answers

0
votes

Starting from Jira 7.0.0, we can use Create project REST API which also allows setting following schemes while creating the project,

1.issueSecurityScheme 2.permissionScheme 3.notificationScheme 4.workflowSchemeId

REST Endpoint: [POST /rest/api/2/project]

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
}

For issuetype and screen schemes, there is no such parameter available which can be set using the above create project rest api.

If you want to create a new jira project which needs to inherit all the configuration of any existing project(or template project) then use the following Rest endpoint to create jira project using shared configuration which will allow you to reuse all schemes which are present in the template project(existing project).

REST ENDPOINT: POST /rest/project-templates/1.0/createshared/{{projectid}}

Sample Request Payload:

    {
        "key": "NEWKEY",
        "name": "New test project",
        "lead": "lead username"
    }

You can get the ProjectID of the template project using the below rest endpoint,

GET /rest/api/2/project/{projectIdOrKey}

enter image description here