Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get image embedded on issue description from REST API

Lair Ortega Dehonor
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!
June 27, 2019

Hi,

I am using the jira rest api and when y query some issue i can get the description and if an imager were embedded in the description the API returns me something like this:

 


(
[type] => mediaSingle
[attrs] => stdClass Object
(
[layout] => center
)

[content] => Array
(
[0] => stdClass Object
(
[type] => media
[attrs] => stdClass Object
(
[id] => 52fa9b66-4880-...-8840ae2ff490
[type] => file
[collection] => jira-918-field-description
[width] => 200
[height] => 183
)
)
)
)

 How could i get the image attached there?

I have tried call the endpoint: GET /rest/api/3/attachment/{id}

But does not accept me the id I get this error: 

{"errorMessages":["El archivo adjunto con id '52fa9b66-...-8840ae2ff490' no existe"],"errors":{}}

 

In the issue response has the node attachment within it i can find the id corresponding with the attachments but I don't know hwo to link each attachment (image) to the enbedded images.

 

The attachment object looks like this:

 

[attachment] => Array
(
[0] => stdClass Object
(
[self] => https://api.atlassian.com/ex/jira/.../rest/api/3/attachment/....
[id] => ....
[filename] => 01.1.1 Login-touchID-activar.jpg
[author] => stdClass Object
(
...
)

[created] => 2019-05-24T10:50:23.914-0500
[size] => 113023
[mimeType] => image/jpeg
[content] => https://....atlassian.net/secure/attachment/..../01.1.1+Login-touchID-activar.jpg
[thumbnail] => https://....atlassian.net/secure/thumbnail/..../01.1.1+Login-touchID-activar.jpg
)
....
)

If I query the attachment id on the /rest/api/3/attachment/{id} endpoint i can get the image information and the file content but i can not link it with the embedded one in the issue description.

Is there any way to achive this?

 

Thanks.

2 answers

0 votes
Pete Dunham May 6, 2020

@Lair Ortega Dehonor 

I found a solution. For me it was related to using api/2 vs api/3. Using api/2 you can send a string that equivalent to what you put in in "edit" of description field text. 

Some additional notes here:

https://community.atlassian.com/t5/Jira-Software-questions/Attached-Picture-Thumbnail-Within-Isuse-Description-from-Jira/qaq-p/1369908#U1371602

0 votes
Pete Dunham
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 5, 2020

Did a solution ever come up for this? 

 

I am battling same thing!

Suggest an answer

Log in or Sign up to answer