Importing attachments into Jira Cloud using CSV External System Importer
When migrating between two Jira Cloud sites using the External System Import with a CSV file, you may get an error when loading an attachment of a migrated issue.
In case of an image, the first thing you'll note is that the thumbnail is broken:
Then, when clicking on it you'll get an error:
This happens because the CSV file comes with references to attachments that may be hosted on an instance that is not publicly accessible, which is the case for most customers. See an example below:
18/Jul/23 3:53 PM;image.png;https://mysite.atlassian.net/rest/api/2/attachment/content/10000
Please beware that some applications commonly used to edit CSV files may automatically reformat (and break) it when you save the file.
In order to make this work, the user importing the CSV file to the target site needs access to the source site (and the issue/s being imported), then generate and add an API token to the URL in the CSV to authenticate to the instance.
See an example below of the same attachment reference, now with authentication details. Note that the '@' symbol on the email address should be replaced with the HTML character '%40', followed by a colon and the API token. Finally, put an '@' symbol just before the hostname of your Cloud site. The rest of the URL will stay the same.
18/Jul/23 3:53 PM;image.png;https://user%40domain.com:<API-Token>@mysite.atlassian.net/rest/api/2/attachment/content/10000
If the source JIRA site is a JIRA Server (self-hosted) instance
Instead of using your JIRA Cloud Email Address and API-Token, you should use your JIRA Server Username and Password instead. For example,
18/Jul/23 3:53 PM;image.png;https://adminuser:email@example.com/rest/api/2/attachment/content/10000
Note that if the password or username has special characters, such as #, ^, %, $, *, etc, then they must be replaced by their URL Encoded equivalent.