Forums

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

I want to add attachments to issues using a script

Akhil Agarwal October 21, 2020

Hi,

I want to copy attachments to linked issues. I went through the Atlassian API documentation and found this

https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-attachments/#api-rest-api-3-issue-issueidorkey-attachments-post

I am fetching attachments from other issues and I can get the URL to the attachment but how do I pass this as a parameter to the above POST request?

If someone has used this earlier, kindly guide me with a sample script.

Thanks

1 answer

0 votes
Kate Kabir
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.
October 22, 2020

Hi Akhil,

Thank you for the question.

To do this you will need to write your own custom script which gets the details of the attachment from the source issue and then calls the Add attachment API which is documented here to add each attachment to the required issue to copy it over.

Please note that we are unable to provide you with an exact script to achieve this requirement as our SLA does not cover custom coding but you can use the examples provided as a reference to create the script that you require, and we would advise asking a question on the Atlassian Community located here if you require assistance with coding the script.

I hope this information helps.

Kind regards,
Kate

Akhil Agarwal October 22, 2020

@Kate Kabir ,

I think I have opened the question in the Atlassian Community itself. This is the reply I got from the Scriptrunner Vendor and they suggested I should open the discussion in the link you mentioned which leads me to this page.

 

For your information, I have fetched the issues and the attachment URLs and I have looked into the Add Attachment script too but I am not sure how to pass the URL as the parameter.

Let me know if you can help me pass the URL as parameter. Thanks

Suggest an answer

Log in or Sign up to answer