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!
4 comments
Comment actions Permalink
Hi,

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.
0
Comment actions Permalink
Is there an example how to add an attachment to an YouTrack issue in https://github.com/JetBrains/youtrack-rest-python-library/tree/master/python I browsed some files, but didn't find one.
0
Comment actions Permalink
Andrey! Can you please help me out a bit? Just a simple example should be enough!
Thanks!
0
Comment actions Permalink
Hello,

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.
0

Please sign in to leave a comment.