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

Adding attachments through Jira API when creating tickets in JSM

Mayur Gaikwad_Tech PMO
Contributor
August 14, 2023

How to attach document or file as an attachment when creating ticket in JSM using REST API’s

we have a requirement wherein user want to use whatsapp as an interface to raise ticket and when using this as a medium he wants to attach local files/snapshots when creating ticket

3 answers

1 accepted

1 vote
Answer accepted
Mayur Gaikwad_Tech PMO
Contributor
August 14, 2023

Hi @Marcus Jones @Thanks for the response. Is it not possible when creating an issue itself. This seems to be for the ones where request is already created

Marcus Jones
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 14, 2023

Perhaps another community member can answer that. This works for me since I am creating the ticket in the same workflow and then using the Key for the just created ticket to call the attachments API and add the attachment. So it actually ends up being two calls. one to create the ticket and one to add the attachments.

Mayur Gaikwad_Tech PMO
Contributor
August 15, 2023

Ok that also sounds good. Let me try

Mayur Gaikwad_Tech PMO
Contributor
August 18, 2023

@Marcus Jones can you guide how can I test this using POSTMAN

getting 415 error when in body i'm passing below details:

 

{
    "filename""Dynamic label change.PNG"
}
1 vote
Yogendra Singh Thakur
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 22, 2024

To use Jira-SD's REST API for attaching files and it is possible when creating an issue itself, follow these steps:

  1. Upload the files and save them as temporary attachments. Refer to the documentation here https://docs.atlassian.com/jira-servicedesk/REST/5.7.0/#servicedeskapi/servicedesk/{serviceDeskId}/attachTemporaryFile

  2. Create an issue using the IDs of the temporary attachments provided by the `/attachTemporaryFile` API. Include these IDs in the "attachment" field, for example: `"attachment": ["4786e3a5-52be-4d5b-bf3d-5f53e54f4559", "1187b2b7-8a75-4eac-88b2-b6e43129ef5c"]`.
0 votes
Marcus Jones
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 14, 2023

Hi Mayur,

The attachment API URL is 

https://<yourinstance>/rest/api/3/issue/<IssueKey>/attachments

 You need to make sure you have the header:

X-Atlassian-Token = no-check

I'm using power automate to enter the File Name and the Body/Content of the message as in the image below:

JiraAPI_CreateAttachment.png

Suvendu Nandy
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 15, 2024

Hello Marcus Jones,

 

what's the Body contains?

I am using content bytes fetch from an attachment as shown in below image.

I am facing issue with an attachment format. When mail with an Image file. In jeera attachment file is getting created with format mismatched.

 

Getting below success response.

 

HTTP 2.PNGattchament Flow.PNG

 

"mimeType": "text/plain; charset=utf-8"

Jeera Attchment response for image.PNG

 

Check with Postman for image Attachment API getting response ("mimeType": "image/png",

Postman attachment works fine. How to implement the same with Power Automate HTTP request. 

 

How to pass/change mimeType while calling Jeera Attachment API 

 

Suggest an answer

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

Atlassian Community Events