Forums

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

Synchronizing attachments between jira server and jira cloud via webhooks and REST API

Michael Smith July 23, 2020

We're creating simple integration between two Jira instances (cloud and server) using Automation for Jira app:

When an issue created (updated) on Jira cloud it sends to Jira server webhook so we can create an issue, update issue fields on Jira server. But what about attachments? We can't figure out what to do with attachments. The REST API documentation says that webhooks does not contain the attachment itself but contains a URI that can be used to download the actual attached file. 
Can we use this URI in "REST API "Add attachment POST /rest/api/2/issue/{issueIdOrKey}/attachments" to attach file in Jira server?

Curl example:

curl -D- -u admin:admin -X POST -H "X-Atlassian-Token: no-check" -F "file=@myfile.txt" http://myhost/rest/api/2/issue/TEST-123/attachments

 

If it's impossible to implement via Automation for Jira app what we can use? Maybe script runner or power script?

1 answer

1 accepted

0 votes
Answer accepted
Matthias Gaiser _K15t_
Community Champion
July 23, 2020

Hi @Michael Smith

I'm not aware of a method how you can implement this with Automation for Jira, but I'm also no expert there.

I wanted to mention other possible ways you could use to solve your problem:

  • Scripting solution
    As you suggested, you could go with ScriptRunner or PowerScript in order to write a script that runs e.g. on every issue update event and checks if your Cloud issue contains new attachments it has to download.
  • Sync solution
    If you don't want to care about writing scripts, you could also use an issue sync app instead. These apps will give you the chance to configure all fields you want to sync (including attachments).

Please note that I'm working for the team behind Backbone Issue Sync. If you have any specific questions in this regard, I'm also happy to help.

Cheers,
Matthias.

Michael Smith July 24, 2020

Hi @Matthias Gaiser _K15t_

Thank you for your answer.  Does "issue sync app" have to be installed on both Jira instances?

Regards,
Michael

Matthias Gaiser _K15t_
Community Champion
July 24, 2020

Yes, that's the usual case for all issue sync apps.

Backbone has another option which has the concept of a remote license. You don't need to install an app on the other side, but you still need two licenses - one Atlassian marketplace license for the instance where it is installed, and in addition a remote license for the other Jira.

You can learn more about this scenario here.

Suggest an answer

Log in or Sign up to answer