Jira REST API - Attach file at the same time as creating an issue - Can it be done?

Jacob Watts February 7, 2020

I have a demo of issue collector setup and working. But some of the limitations - like the cascading select list - have me considering the REST API. We definitely want users to be able to submit attachments when they create issues. Our current production solution doesn't allow them and it's a big part of why I started working on issue collector.

I've been researching the REST API and what I'm finding, so far, seems to be that I'd have to create the issue first and then attach the file.

Is that still the current behavior?

1 answer

0 votes
Thomas Deiler
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 7, 2020

Dear @Jacob Watts ,

so it is. The reason is simple. Creating an issue required posting JSON payload. Adding an attachment required posting a MultiPartMime. Both the same time is not possible at the moment.

So long

Thomas

Jacob Watts February 7, 2020

Thank you @Thomas Deiler 

Thats a pretty big limitation.

How hard would it be to have backend code create the ticket. Then use the returned ticket ID(I believe I read it can return that upon ticket creation) and then use that ID to attach a file all with the same submit button press?

Is there existing code anyone has written to do something like this?

Thomas Deiler
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 7, 2020

Dear @Jacob Watts ,

it's not a big deal. When creating the issue, you get the new issue key returned in the JSON response. Then posting the attachment is as simple as described in the api documentation.

So long

Thomas

Jacob Watts February 7, 2020

Thanks, hopefully they make it easier in the future!

Suggest an answer

Log in or Sign up to answer