Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,323,606
Community Members
 
Community Events
168
Community Groups

How do I upload an attachment to an issue via powershell?

I have been searching online for a while and I've not found a solid answer to this (lots of partial answers, though).  Still nothing I do works.

I'm trying to write a powershell script to send attachments to JIRA using cURL (have not found another way that I can get to work).

My cURL command is:

C:\opt\curl\curl.exe -u user:pa$$word -X POST -H "X-Atlassian-Token: nocheck" -F "file=@C:\opt\attachments\75391_testingPNG.png" http://jira.ourURL.com/rest/api/2/issue/75391/attachments

 

This works perfectly from the command line.  Anytime I try to run it via powershell it bombs out.  Seems like it should be very easy to do, though.  Just want to grab the files from a directory and send them to JIRA.

Anyone have any thoughts about this???  Thanks!

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted

With some assistance from someone on StackOverflow, we figured this out.

Start-Process C:\opt\curl\curl.exe -argumentList "-u", "user:pa`$`$Word", "-X", "POST", "-H", "`"X-Atlassian-Token: nocheck`"", "-F", "`"file=`@C:\opt\attachments\75391_testingPNG.png`"",  "http://jira.ourURL.com/rest/api/2/issue/75391/attachments"

Thanks.

Glad you figured it out, @Charles Bastian.   Another option – just for future reference – is the JIRA Command Line Interface (CLI) add-on, which allows you to do anything that is exposed by JIRA's APIs. Its supported actions include addAttachment, getAttachment, getAttachmentList, removeAttachment, runFromAttachmentList, and many more.

TAGS
Community showcase
Published in Apps & Integrations

4 Amazing Product and Project Management Apps compete for Best App Demo in July Appy Hours 🥳

Thanks so much to everyone who joined for our July Appy Hours! Product and project management presenter highlights  Checkout - Procurement and asset manager, presented by @Vincent Mutambuki ...

90 views 1 8
Read article

Atlassian Community Events