Attach file to an issue or issue's comment from workflow
Hello,
In our company we use two YouTrack servers: "internal" and "external" ones. When adding an attachment to an issue in the "external" YouTrack, it is necessary to automatically copy this attachment to the "internal" one to the same issue. Now we are copying the task itself, its description, but not the attached files. How can we copy attachments?
I know, that it's not possible now to attach file to an issue in workflow using base64. But I want to know if these methods can work to attach a file to an issue:
- Get binary data from fileUrl and use it in payload of postSync (I tried this method but it works only with text files, but not .exe, .png, etc. Maybe I did some mistakes);
- Add a comment to issue in "internal" YouTrack and attach file to this comment.
- Use fileUrl. If I'm not mistaken, these links are valid for three days. So this option doesn't seem to work either.
If any of theese method can work, please tell me how to do it right. Or maybe there are other ways to do it.
I'd really appreciate some help as I've been struggling with this for two weeks now.
Thank you.
Please sign in to leave a comment.
Hello!
If I understand you correctly, you need to implement the following work scenario:
The above can be made possible using the postSync method in the workflow. This method is used to send requests outside YouTrack. Attachment.content can serve as the payload in postSync.
You may also check this example of how one can attach files to an issue using REST API.
Let us know if you have more questions here.
Yes, the scenario is correct. But there are two difficulties in your proposed solution:
If I misunderstand something, please provide a code snippet to implement this scenario.
Thanks for the advice.
But in this task, we need to instantly copy applications.
We came to the following sulution: to allocate a separate server (with python), to which we pass the fileURL. The server gets the binary data from given url and sends it via REST API to the internal YouTrack.
Thanks for getting back to us. I am glad you found a solution that suits your case.
Let us know if you have any other questions—we'll be happy to help.