Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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

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
Community showcase
Published in Trello

🏊‍♀️ Atlympic Event: Trello

Hello Community!  Quick disclaimer: We are running a contest on Community (The Atlympics!) from July 23rd - August 8th of 2021. If you are interested in participating in this contest (prizes! ...

172 views 2 13
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you