JSON からのデータのインポート

JIRA にバンドルされているJIRA Importers プラグインバージョン 4.3 以降を使用すれば、JavaScript Object Notation (JSON) ファイルからデータをインポートできます。

JSON ファイルは CSV ファイルよりも読み取りが容易で、多くの構造と情報をカプセル化できます。

JSON インポート機能により、次の外部 (課題トラッキング) システムから課題をインポートできます。

  • JIRAは専用のインポートツールを提供していません、そして
  • JSON 形式でデータをエクスポートすることができます

JSON ファイルを手動で準備することもできます。

(warning) JIRA Importers プラグインで使用されるインポート形式は、JIRA REST API を使用する場合のインポート形式よりもシンプルです。

On this page:

インポート用 JSON ファイルの作成

現在の課題トラッキングシステムで JSON 形式のエクスポートができない場合、ファイルを手動で作成できます。JSON ファイルを準備するには、標準の JSON 形式を使用し、次のパターンに従ってください。

JSON ファイルの例
{
    "users": [
        {
            "name": "alice",
            "fullname": "Alice Foo"
        },
        {
            "name": "bob",
            "fullname": "Bob Bar"
        }
    ],
    "links": [
        {
            "name": "sub-task-link",
            "sourceId": "2",
            "destinationId": "1"
        },
        {
            "name": "Duplicate",
            "sourceId": "3",
            "destinationId": "2"
        }
    ],
    "projects": [
        {
            "name": "A Sample Project",
            "key": "ASM",
			"type": "software",
            "description": "JSON file description",
            "versions": [
                {
                    "name": "1.0",
                    "released": true,
                    "releaseDate": "2012-08-31T15:59:02.161+0100"
                },
                {
                    "name": "2.0"
                }
            ],
            "components": [
                "Component",
                "AnotherComponent"
            ],
            "issues": [
                {
                    "priority" : "Major",
                    "description" : "Some nice description here\nMaybe _italics_ or *bold*?",
                    "status" : "Closed",
                    "reporter" : "alice",
                    "labels" : [ "impossible", "to", "test" ],
                    "watchers" : [ "bob" ],
                    "issueType" : "Bug",
                    "resolution" : "Resolved",
                    "created" : "2012-08-31T17:59:02.161+0100",
                    "updated" : "P-1D",
                    "affectedVersions" : [ "1.0" ],
                    "summary" : "My chore for today",
                    "assignee" : "bob",
                    "fixedVersions" : [ "1.0", "2.0" ],
                    "components" : ["Component", "AnotherComponent"],
                    "externalId" : "1",
                    "history" : [
                        {
                            "author" : "alice",
                            "created": "2012-08-31T15:59:02.161+0100",
                            "items": [
                                {
                                    "fieldType" : "jira",
                                    "field" : "status",
                                    "from" : "1",
                                    "fromString" : "Open",
                                    "to" : "5",
                                    "toString" : "Resolved"
                                }
                            ]
                        }
                    ],
                    "customFieldValues": [
                        {
                            "fieldName": "Story Points",
                            "fieldType": "com.atlassian.jira.plugin.system.customfieldtypes:float",
                            "value": "15"
                        },
                        {
                            "fieldName": "Business Value",
                            "fieldType": "com.atlassian.jira.plugin.system.customfieldtypes:float",
                            "value": "34"
                        }
                    ],
                    "attachments" : [
                        {
                            "name" : "battarang.jpg",
                            "attacher" : "admin", 
                            "created" : "2012-08-31T17:59:02.161+0100",
                            "uri" : "http://optimus-prime/~batman/images/battarang.jpg",
							"description" : "This is optimus prime"
                        }
                    ]                    
                },
                {
                    "status" : "Open",
                    "reporter" : "bob",
                    "issueType": "Sub-task",
                    "created" : "P-3D",
                    "updated" : "P-1D",
                    "summary" : "Sub-task",
                    "externalId": "2"
                },
                {
                    "status" : "Closed",
                    "reporter" : "alice",
                    "issueType": "Sub-task",
                    "created" : "P-3D",
                    "updated" : "P-1D",
                    "resolution" : "Duplicate",
                    "summary" : "Duplicate Sub-task",
                    "externalId": "3"
                }
            ]
        }
    ]
}

カスタム フィールド

JSON Importers プラグインではカスタムフィールドがサポートされています。次に、JIRA で用意されているカスタムフィールドの一覧を示します。 カスタムフィールドのがある追加のプラグインをインストールしている場合はそれらのフィールドもサポートされますが、この一覧には含まれていません。

用意されているカスタムフィールドの一覧
  1. com.atlassian.jira.plugin.system.customfieldtypes:textfield

  2. com.atlassian.jira.plugin.system.customfieldtypes:textarea

  3. com.atlassian.jira.plugin.system.customfieldtypes:datepicker

  4. com.atlassian.jira.plugin.system.customfieldtypes:datetime

  5. com.atlassian.jira.plugin.system.customfieldtypes:float

  6. com.atlassian.jira.plugin.system.customfieldtypes:select

  7. com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons

  8. com.atlassian.jira.plugin.system.customfieldtypes:project

  9. com.atlassian.jira.plugin.system.customfieldtypes:multiversion

  10. com.atlassian.jira.plugin.system.customfieldtypes:version

  11. com.atlassian.jira.plugin.system.customfieldtypes:userpicker

  12. com.atlassian.jira.plugin.system.customfieldtypes:url

  13. com.atlassian.jira.plugin.system.customfieldtypes:multiselect

  14. com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes

  15. com.atlassian.jira.plugin.system.customfieldtypes:multiuserpicker

  16. com.atlassian.jira.plugin.system.customfieldtypes:multigrouppicker

  17. com.atlassian.jira.plugin.system.customfieldtypes:grouppicker

  18. com.atlassian.jira.plugin.system.customfieldtypes:cascadingselect

  19. com.atlassian.jira.plugin.system.customfieldtypes:readonlyfield

  20. com.atlassian.jira.plugin.system.customfieldtypes:labels

次のカスタムフィールドの例では、カスタムフィールドを追加するための構文を示しています。カスケード型カスタムフィールドの例も含まれます。前の一覧にカスタムフィールドがない場合は、「カスタムフィールドの設定」ページでソース HTML を調べて "fieldType" を取得できます。"value" は各カスタムフィールドに固有です。これは、「課題の編集」ページでソース HTML を調べることで確認できます。

カスタム フィールドの例
 "customFieldValues": [
                    //Custom Fields which accepts single values:
                        {
                            "fieldName": "My Awesome Text Field (single line)",
                            "fieldType": "com.atlassian.jira.plugin.system.customfieldtypes:textfield",
                            "value": "some text"
                        },
                        {
                            "fieldName": "My Awesome Select List (single choice)",
                            "fieldType": "com.atlassian.jira.plugin.system.customfieldtypes:select",
                            "value": "some select"
                        },
                    //Custom Fields which accepts multiple values:
                        {
                            "fieldName": "My Awesome Checkboxes",
                            "fieldType": "com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes",
                            "value": [ "multiple", "checkboxes" ]
                        },
                        {
                            "fieldName": "My Awesome User Picker (multiple users)",
                            "fieldType": "com.atlassian.jira.plugin.system.customfieldtypes:multiuserpicker",
                            "value": [ "admin", "fred" ]
                        },
                    //Custom Fields which accepts Options in hierarchy. That's only cascading select from standard JIRA pool.
                         {
                            "fieldName": "My Awesome Select List (cascading)",
                            "fieldType": "com.atlassian.jira.plugin.system.customfieldtypes:cascadingselect",
                            "value":
                            {
                                "": "Parent Value",
                                "1": "Child Value"
                            }
                        }
]

JSON ファイルの具体例

次に、JSON ファイルの具体例を示します。

サポートされているフィールド注意
ユーザーこの例ではフルユーザーに対応し、、2つのグループが指定されています。グループが存在しない場合、JIRA Importers プラグインによって作成されます。
ユーザーの例
"users": [ 
	{
        "name" : "someuser",
        "groups" : [ "jira-users", "my-custom-group" ],
        "active" : true,
        "email" : "user1@example.com",
        "fullname" : "User 1"
	}
]
プロジェクトキーと課題キー プロジェクトと課題の両方にキーを割り当てることができます。これらのキーは異なっていてかまいません。この例では、1つの課題があるプロジェクト "SAM-123" が作成されます。
プロジェクト キーと課題キーの例
{
    "projects": [
        {
            "name": "Sample data",
            "key": "SAM",
			"type": "software",
            "issues": [
                {
					"key" : "SAM-123",
                    "status" : "Open",
                    "reporter" : "admin",
                    "summary" : "Parent case",
                    "externalId": "123"
                }
            ]
        }
    ]
}
コメントこの例では、課題について複数のコメントをインポートする方法を示しています。
コメントの例
{
    "projects": [
        {
            "name": "Sample data",
            "key": "SAM",
            "issues": [
                {
                    "status" : "Open",
                    "reporter" : "admin",
                    "summary" : "Parent case",
                    "externalId": "1",
                    "comments": [
                        {
                            "body": "This is a comment from admin 5 days ago",
                            "author": "admin",
                            "created": "2012-08-31T17:59:02.161+0100"
                        },
                        {
                            "body": "This is a comment from admin 1 day ago",
                            "author": "admin",
                            "created": "2012-08-31T17:59:02.161+0100"
                        }
                    ]
                }
            ]
        }
    ]
}

作業ログ

この例では、作業ログの詳細をインポートするための構文を示しています。
作業ログの例
"worklogs": [
        {
            "author": "admin",
            "comment": "Worklog",
            "startDate": "2012-08-31T17:59:02.161+0100",
            "timeSpent": "PT1M"
        },
        {
            "author": "admin",
            "startDate": "2012-08-31T17:59:02.161+0100",
            "timeSpent": "PT3H"
        }
    ]
コンポーネントJSON ファイルでコンポーネントを指定する方法は2通りあります。名前を指定する方法とオブジェクトを指定する方法です。この例では両方を示しています。JIRA Importers プラグインでは、常に「既定の担当者」が「プロジェクトの既定」に設定された新規コンポーネントが作成されます。ユーザーは「既定の担当者」を指定できないからです。
コンポーネントの例
            "components": [
                "Component", //Component specified only by name
                { // Component specified by object
                    "name": "SomeName",
                    "lead": "admin",
                    "description": "Some description"
                }
            ],
タイムトラッキング付きの課題課題とともに、タイムトラッキングの詳細をインポートできます。この例では、タイムトラッキングの詳細を含む課題を示しています。 "originalEstimate"、"timeSpent"、"estimate" の値は Period 形式 (Format ISO_8601 - Durations) に従っている必要があります。"startDate" の値には DateTime と Period 形式の両方を使用できます。

インポートを開始する前に、JIRA でタイムトラッキングが有効になっていることを確認してください。有効になっていない場合、インポート中に JIRA Importers プラグインでデータが無視されます。

タイムトラッキング付きの課題
            "issues": [
                {
                    "summary" : "My Example Time Tracking issue",
                    "externalId": "1",
                    "originalEstimate": "P1W3D",
                    "timeSpent": "PT4H",
                    "estimate": "P2D",
                    "worklogs": [
                        {
                            "author": "admin",
                            "comment": "Worklog",
                            "startDate": "P-1D", //can be a Period or DateTime
                            "timeSpent": "PT1M"
                        },
                        {
                            "author": "admin",
                            "startDate": "2014-01-14T17:00:00.000+0100",
                            "timeSpent": "PT3H"
                        }
                    ]
                }
            ]

日付の表現には、SimpleDateFormat "yyyy-MM-dd'T'HH:mm:ss.SSSZ" (出力例:  "2012-08-31T15:59:02.161+0100")、または "P-1D" (1日前) などの相対日付を使用できます。

JSON File Import Wizard の実行

開始する前に、JIRA データをバックアップしてください。

  1. JIRA 管理者グローバル権限を持つユーザーとしてログインします。
  2. > [システム] を選択します。[インポートとエクスポート] > [外部システム インポート] を選択し、[外部プロジェクトのインポート] ページを開きます。
  3. JSON を選択してJSON ファイル インポートページを開きます。
  4. JSON ファイルを選択します。
  5. JSON ファイルを JIRA にインポートする準備ができたら、インポート開始ボタンをクリックします。インポーターは、インポートの進行に合わせて更新状況を示し、インポートが完了すると、正常完了したことを示すメッセージを表示します。

(info) 注: インポートで問題が生じた場合 (または関心がある場合)、詳細ログのダウンロードリンクをクリックして、JSON ファイルのインポートプロセスに関する詳細情報を表示します。この情報は、インポートでエラーが発生した場合も役立ちます。

おめでとうございます!JSON プロジェクトが Jira に正常にインポートされました!ご不明な点や、問題が生じた場合は、アトラシアン サポートにご連絡ください。

最終更新日: 2018 年 10 月 2 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.