Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Uploading attachments via REST API (JIRA)

Hello! 

We are currently undergoing a migration and I need to bulk upload attachments to existing Jira tickets from a local store; I am attempting to follow the REST API code provided on Atlassian Confluence: 

curl -D- -u {username}:{password} -X POST -H "X-Atlassian-Token: nocheck" -F "file=@{path/to/file}" http://{base-url}/rest/api/2/issue/{issue-key}/attachments

I've created an API key and input this as the password with the username.
When running this I am receiving: 

curl: (26) Failed to open/read local data from file/application

I have attempted moving this file into a higher location and using both parent folder and the document as the {path/to/file} but I must be missing something as I am very new to this. 

Thank you in advance for any support. 

 

1 answer

1 accepted

0 votes
Answer accepted
Prince Nyeche Community Leader Apr 23, 2021

Hi @Matt Smith 

Are you migrating from server to cloud instance or from a cloud to cloud instance?

Hey @Prince Nyeche

Thanks for your quick response, it's cloud to cloud - as far as I am aware there is no clean way to do it, 

What we're attempting is bulk download via a 3rd party application available on the Atlassian marketplace and then attempting to find a bulk upload process, 

Thank you! 
Matt

Prince Nyeche Community Leader Apr 23, 2021

Hey @Matt Smith 

If you're familiar with a little bit of python, there's this script I made which does a bulk attachment from instance to instance, fetching the attachments based on JQL. All you need to do is follow the instruction on the readme.md file and you'll be able to migrate your entire attachments without the need to download it.

Prince Nyeche Community Leader Apr 23, 2021

Even though it's a server to cloud implementation, it works on a cloud to cloud instance as well. Let me know if you can use that instead or if you have any questions on it.  Also i wrote this article a few months back on how to transfer attachments between cloud instances via API, you can also take a look at that too.

Hey @Prince Nyeche  

Thanks for your help on this, 

The first solution wont work for our example as I understand as our destination project key is different to our source project key, 

I will take a deeper look into the second option over the weekend, admittedly a python novice but I'm thinking our bottle neck will be the fact all of the incidents are not in our workspace currently as we are doing an incremental migration due to the source being currently worked in. 

I will get back to you early next week with any success/failures I have, 

Thank you for your time. 
Matt

Like Jocelyn Weber likes this

I wonder if it would work to update the project keys in the old space after the users are in the new space and then run this? 

Like Matt Smith likes this

Good Morning @Prince Nyeche 

I have successfully extracted the attachments this morning via your article. 

I notice on there that this advises that the keys must be the same - as we have amended this in our workspace they will not be the same. 

Looking at the csv I notice it stores Project Key and Issue Key, if I manually amend these in the CSV to match our target do you think this will be successful? Admittedly still a good amount of manual work but significantly less than manually uploading the docs. 

Thank you! 
Matt 

Prince Nyeche Community Leader Apr 26, 2021

Hey @Matt Smith 

Yes, if you do that it will upload to those issue keys. As long as you have the report you can manipulate anything you need. Let me know how it goes.

Hey @Prince Nyeche 

So I have followed the article quite strictly, I updated the CSV's Project ID, Project Key, Project name and Issue Key to match the destination Project but am receiving the following error when running the import script. 

requests.exceptions.MissingSchema: Invalid URL 'ESINTG': No schema supplied. Perhaps you meant http://ESINTG?

Appreciate any assistance, 
Matt 

@Prince Nyeche it works! 

I was misunderstanding the keyword args but after getting my head around that I can see it in action! 

This has no doubt saved tens of hours of manual work and massively help with the integration and maintaining my sanity. 

Thank you! 
Matt

Prince Nyeche Community Leader Apr 26, 2021

Awesome @Matt Smith! Glad to hear it works for you. Have a good day ahead.

Like Matt Smith likes this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

Staying organized with Jira: best practices for a better project management

Project managers know this problem: A “mountain of work” lays in front of you, and you don’t know how and where to tackle them. Different to-dos lie ahead, but just one task after the other can be ha...

233 views 2 1
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