Python API to add attachments
Hi!
I try to add an attachement to an issue (using Python wrapper), but I have no luck so far. Creating and adding an issue works fine.
Can someone help me out with the creating an attachment from file and adding it to an issue?
Thanks!
I try to add an attachement to an issue (using Python wrapper), but I have no luck so far. Creating and adding an issue works fine.
Can someone help me out with the creating an attachment from file and adding it to an issue?
Thanks!
Please sign in to leave a comment.
Could you, please, provide us with details of your realisation?
You can look at all attachment-related methods here https://github.com/JetBrains/youtrack-rest-python-library/blob/master/python/youtrack/connection.py .
Thank you.
Thanks!
Sorry for not responding earlier.
The most suitable for you is "createAttachment" method.
Difference between "importAttachment" method and "createAttachment" is that, with "importAttachment" method attachments will be added under each user as it should be. With "createAttachment" method attachments will be added under one particular user.
I think the most helpful example will be real example of import script. So, please take a look at the trac2youtrack.py (https://github.com/JetBrains/youtrack-rest-python-library/blob/master/python/trac2youtrack.py) on our Git.
The most interesting for you is "Importing attachments" code block. There you can see how "createAttachment" method is used.
Thank you.
Let me know if it doesn;t help, I'll provide you with assistance.