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,300,778
Community Members
 
Community Events
165
Community Groups

Creating Projects via JSON Import

I'm trying to build a tool that will export our Redmine data and process it into a format that can then be easily imported into Jira. I've built the script for exporting the Redmine data we need and now I'm just trying to figure out the import format Jira requires. The JSON documentation is sparse and outdated, to say the least. I've worked through a few problems (like requiring undocumented `template` and `type` fields), but I cannot figure out how to create projects when importing.

I am working with a slightly modified example from the documentation:

{
"projects": [
{
"name": "Sample data",
"key": "SAM",
"type": "business",
"template": "Project management",
"issues": [
{
"key" : "SAM-123",
"status" : "To Do",
"summary" : "Parent case",
"externalId": "123"
}
]
}
]
}

When I go to Settings -> System -> External System Import -> JSON and import that file, it presents me with this error:

Unexpected failure occurred. Importer will stop immediately. Data may be in an unstable state: Unable to create project: ExternalProject{id='null', key='SAM', externalName='null', name='Sample data', type='business', template='Project management'}: Invalid module key specified:

If I change the `key` field to a project key that already exists, it imports without issue so that seems to imply that I can't use a project whose Project Key does not already exist even though the docs seem to imply otherwise (emphasis mine):

You can assign a key to both the project and the issue. These keys can be different. This example will create a project with one issue, "SAM-123".

What am I doing wrong when trying to create these projects? We intend to import between tickets to around 300 projects, so being able to automatically create these will be crucial.

2 answers

1 accepted

0 votes
Answer accepted

After a bunch of trial and error to figure out all the kinks of my import process and a lot of changes to the process, I decided against importing the projects via CSV or JSON and instead create them via the Cloud API, which is pretty well documented and features a lot of additional features the CSV and JSON importers are missing.

I recommend anyone who sees this post to skip the trying to do it via CSV or JSON and instead spend a few hours building out a script to do it via the API. You'll save time in the long run.

I still have not figured out how to create projects via the JSON importer, but I have figured out a workaround that I think I will proceed with. Basically I do a two step process:

  1. Import Projects via the CSV importer
  2. Import Issues to those Projects via JSON importer

I discovered that I can import projects very easily just using this CSV:

Name,Summary,Key,Type
Imported Project 1,Imported 2021-07-02,IP1,business
Imported Project 2,Imported 2021-07-02,IP2,business

That will create two different projects, each with an "Imported 2021-07-02" ticket that I can then do a mass search/delete for. If I then import the below JSON:

{
  "projects": [
      {
        "name": "Imported Project 1",
        "key": "IP1",
        "type": "business",
        "template": "Project management",
        "issues": [
          {
          "key" : "IP1-123",
          "status" : "Open",
          "summary" : "Parent case",
          "externalId": "43829"
        },
        {
          "key" : "IP1-456",
          "status" : "Open",
          "summary" : "Another Ticket",
          "externalId": "5239"
        }
      ]
    }
  ]
}

It correctly imports 2 tickets into the IP1 project created by the CSV importer

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Work Management

Join us for a live demo of Jira Work Management

Interested in learning more about Jira Work Management? Have questions you want to get answered? Join us for our upcoming live demo where we’ll take you through the essentials of Jira Work Manageme...

1,740 views 4 12
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