Problem: The built-in JIRA Export to CSV only lists the linked issue's key, but not the link type. This is a known limitation. For example, see here: Known Issue.
I am performing an export of many issues in order to import them via CSV to another JIRA server, and I need to know the link type.
The solution that I devised is to export to JSON instead of CSV.
Step 1: Create an input JSON (save it in file input.json). Note that you cannot retrieve more than 1000 issues in one call, so you need to limit the search and perform subsequent calls if you have more than 1000 issues.
{
"jql": "project = \"Your project name here\" AND key >= FOO-1 AND key < FOO-1001 order by key asc",
"maxResults": 1000,
"fields": [
"issuetype",
"status",
"summary",
"issuelinks",
"customfield_11280",
...
]
}
Step 2: Run curl on the JIRA server's REST API with the above JSON. This is on Linux and you need to have 'jq' installed:
curl -k -u user:password -X POST -H "Content-Type: application/json" --data @infile.json https://jira.acme.com/rest/api/2/search | jq '.' > outfile.json
Step 3: The output file will have all the issues and in each, the fields that you've specified:
{
"expand": "schema,names",
"startAt": 0,
"maxResults": 1000,
"total": 502,
"issues": [
{
"expand": "operations,editmeta,changelog,transitions,renderedFields",
"id": "140026",
"self": "https://acme.com/rest/api/2/issue/140026",
"key": "FOO-1",
"fields": {
"issuetype": {
"self": "https://jira.acme.com/rest/api/2/issuetype/26",
"id": "26",
"description": "",
"iconUrl": "https://jira.acme.com/images/icons/issuetypes/improvement.png",
"name": "CCB",
"subtask": false
},
"customfield_11280": {
"self": "https://jira.acme.com/rest/api/2/customFieldOption/12252",
"value": "No",
"id": "12252"
},
"issuelinks": [
{
"id": "59700",
"self": "https://jira.acme.com/rest/api/2/issueLink/59700",
"type": {
"id": "10020",
"name": "Related",
"inward": "Related",
"outward": "Related",
"self": "https://jira.acme.com/rest/api/2/issueLinkType/10020"
},
"inwardIssue": {
"id": "139870",
"key": "NGAC-9643",
"self": "https://jira.acme.com/rest/api/2/issue/139870",
"fields": {
"summary": "BCP || Cases still exists in queue after case was closed",
"status": {
"self": "https://jira.acme.com/rest/api/2/status/6",
"description": "The issue is considered finished, the resolution is correct. ",
"iconUrl": "https://jira.acme.com/images/icons/statuses/closed.png",
"name": "Closed",
"id": "6",
"statusCategory": {
"self": "https://jira.acme.com/rest/api/2/statuscategory/3",
"id": 3,
"key": "done",
"colorName": "green",
"name": "Done"
}
},
"priority": {
...,
"id": "3"
},
"issuetype": {
...
}
}
}
}
],
# more fields here
}, # end of the 1st issue here
{ # start of next issue
...
}
] # end of all issues
} # end of the JSON
Step 4: If you need your output as CSV, use your favorite programming/scripting language to transform the JSON to CSV. This is basically what the JIRA UI does when you do Export to CSV...
Enjoy.
Amir Katz (Outseer)
Technical Lead
Outseer, an RSA company
Israel
21 accepted answers
3 comments