What is the correct procedure of adding attachment to Issue through plugin?

Seyid Aghayev June 17, 2021

I need a correct procedure of adding an attachment to Issue programmatically. 

When using REST api we need to provide user login and password. I can not get password for any user. 

When using an existing method of creating attachment, which is:

CreateAttachmentParamsBean attachmentParamsBean = new CreateAttachmentParamsBean.Builder(new File(path),
                filename, "text/plain", context.getLoggedInUser(),
                issue).build();
        ChangeItemBean bean = ComponentAccessor.getAttachmentManager().createAttachment(attachmentParamsBean);

 Attachment is not seen in issue history log. Can anyone help me with this? Thank you

1 answer

0 votes
Vero Rivas
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.
June 17, 2021
Seyid Aghayev June 17, 2021

Hello @Vero Rivas , thank  you for the response,

All of these sources use Basic Auth, where user login and pass are required, but I can not get password from users to include it in the REST request. 

The only functionality I have found is the one that I use from Atlassian SDK. It does not work correctly, because it adds an attachment, but it is not seen in history log. Is there anything else, where I can use the logged in user as an author of the added attachment? 

Thank you 

Suggest an answer

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

Atlassian Community Events