Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

importing attachments from server to cloud, how to change the name?

Jay Keck
Contributor
June 25, 2019

I'm in the process of exporting an xml file from a jira server and converting to csv and then importing into jira cloud. I don't have access to to an http or https site where I can dump my attachments, so I'm going to use curl and jira apis to load attachments after csv has been imported. it works, but I can't see how I can provide a name parameter, since internal the attachment s files are named with the id rather than the filename itself, it won't be very useful once they're loaded into the cloud to have an attachment called 12345 vs 'mystatusreport.docx'. Is there a way to override the name without having to actually rename all of the files before I import them? apparently the importer can read this info from the csv and change filename description when it pulls them from the https site, true? 

2 answers

1 accepted

0 votes
Answer accepted
Dave Theodore [Coyote Creek Consulting]
Community Champion
June 25, 2019

Why wouldn't you just import the XML and attachments in to Cloud directly? Sounds like you're doing it the hard way.

If you insist on doing it via CSV, you will need to run a DB query to determine the original filename and the pointer to the file on disk, then rename the file based on the name from the database. In the process, you will also need to do a join to capture the issue number that each attachment belongs to and capture this in a mapping table so you can get teh attachments to the correct issue. Jira isn't capable of reading the files mime type to determine what kind of file it is. It uses the file extension, so you will need to rename to the original extension at minimum.

Jay Keck
Contributor
June 27, 2019

Hi Dave,

This is for a case where it's an existing cloud instance with other projects, and we want to import the server issues and attachments into an existing project without disrupting any other existing issues or attachments. I'm not seeing an option under  import from external system for xml, just json and csv. From the xml I have the old issue #, filename and attachment id which i can import into cloud then export back out the new issue #, old issue # filename attachment id and build my curl command from it. from what I've read importing it any other way will get rid of existing data in the instance, did I not understand it correctly?

If there's an easier way to import issues/attachments into an existing cloud project, I'm all for it!

Jay

Dave Theodore [Coyote Creek Consulting]
Community Champion
June 27, 2019

You answered my question, in that you already have data in your Cloud instance. XML import is for a case where you are migrating from Server to an empty Cloud instance.

You have two options. Do as you propose where you either use CSV or the REST API, or you follow this process to do the merge in a Server instance. Unfortunately, there isn't a "merge instance" button.

0 votes
Jay Keck
Contributor
June 27, 2019

Hi Dave,

I was afraid of that. It's a good chance for us to cleanup some overgrown server workflows so we really do just want the issues and the attachments, so I guess I'll stick with my original plan. Thanks for looking into this!

JAy

Suggest an answer

Log in or Sign up to answer