Forums

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

Create an attachment via automated webhook to JIRA REST-API by providing attachment URL

Chris Fortmueller
Contributor
March 29, 2021

JIRA does not currently support the copying of comments or attachments when cloning issues (see https://jira.atlassian.com/browse/JRACLOUD-5052). However, this is a requirement for us in certain cases. I am therefore trying to implement a similar feature to copy attachments via sending HTTP requests from Automation for Jira.

I have been able to do this via postman with the following configuration:

attachment via postman header.PNGattachment via postman bodyPNG.PNG

 

 

Can I also, instead of selecting a file in the second screenshot via the explorer, provide the JIRA REST-API with a file URL? If that would work, I could use webhook request in Jira Automation...

webhook.PNG

 

1 answer

0 votes
Prince Nyeche
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 29, 2021

Hi @Chris Fortmueller 

Copying attachment from one instance to another or project to another is very possible via API. However using automation and webhook seems more like manual task would be involved rather than it being automated. i.e. how will the attachment url be extracted dynamically using automation and how would automation post the data back to another project or instance?

Chris Fortmueller
Contributor
March 30, 2021

This is happening in the context of cloning an issue, so I would do it via the smart value {{attachment.filename}}.

 

You seem to have some other solution in mind for doing this?

Prince Nyeche
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 30, 2021

Ok, once you get the url for the attachment that's one step, how do you post back a binary data to Jira? What I'm thinking here is that using a webhook service, you can send the request there (which includes, the instance url, issue key, attachment url) and the webhook service will extract the file (authentication is needed for proper extraction) as binary data then fire another request to Jira attachment endpoint with a POST request of the binary data. That way, you get a copy of the attachment on another issue key.

Chris Fortmueller
Contributor
March 31, 2021

I was thinking along the same lines. But our IT Infrastructure doesn't match the requirements for hosting such a webhook service, since it would need to be accessible for the world via a DNS-Name/IP... For the moment, it seems I am stuck waiting for https://jira.atlassian.com/browse/JRACLOUD-5052... :/

Prince Nyeche
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 31, 2021

The alternative is to use an addon as suggested on one of the comment on this ticket JRACLOUD-5052 

Chris Fortmueller
Contributor
April 1, 2021

Thanks Prince, might give one of them a shot.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events