My team is currently working on an API connection for our service desk. We are facing issues regarding having an attachment image come back with the API request to be uploaded as a comment. We have tried three options (outlined below) and these have not worked for us.
We are looking to hear from anyone who has encountered this issue with APIs and learn what your resolution was. Currently, our internal Forge team does not have a resolution to this so we are looking for ways to make this work, as the key part of the return API is having an image uploaded into the ticket as a comment.
Thank you for any suggestions!
Our Ideas and Attempts:
Hi @Kate Murphy Welcome to Atlassian Community!
To include an image in a comment using ADF, you first need to upload the image as an attachment to the work item. After the upload is complete, the next step is to retrieve the mediaId of that attachment so it can be referenced within the ADF comment node.
Currently, there is no direct API that returns the media ID. However, you can obtain it by fetching the attachment content using the following endpoint:
GET https://${site-url}/rest/api/3/attachment/content/${contentId}
When you perform an HTTP GET request on this URL, the response will return a redirect (via the Location header) to a Media Services URL similar to the one below:
https://api.media.atlassian.com/file/12345678-1234-1234-1234-123456789abc/binary?token=WHATEVER&client=WHATEVER&dl=true&name=something.jpg
The UUID value that appears after /file/ (for example, 12345678-1234-1234-1234-123456789abc) is the media ID you need.
Once you have this media ID, you can reference it in your ADF structure to embed the image in a comment.
For example:
{
"version": 1,
"type": "doc",
"content": [
{
"type": "mediaSingle",
"attrs": {
"layout": "align-start",
"width": 100.0,
},
"content": [
{
"type": "media",
"attrs": {
"id": "12345678-1234-1234-1234-123456789abc",
"type": "file",
"collection": ""
}
}
]
}
]
Hello @Akash Singh
Do you have any experience or a way to relate this to Base64 decoding for this scenario?
Thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Kate Murphy
What is your direct requirement you want to make a comment on a request and embed an attachment in that comment.
Is this done as a customer or as an agent (license user)?
If this is from the customer perspective, so no licensed JSM agent, https://developer.atlassian.com/cloud/jira/service-desk/rest/api-group-request/#api-rest-servicedeskapi-request-issueidorkey-attachment-post
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Marc -Devoteam-
We want to decode a Base64 image to be able to be added as a comment within the Jira Issue. This image is coming as a result of an API call from a third party using a Jira automation rule.
Thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.