Attached Picture Thumbnail Within Isuse Description from Jira Cloud Rest API (Update or Create)

Pete Dunham May 5, 2020

I have not been able to find a solution for embedding an already attached image as a thumbnail through the Jira Cloud Rest API.

When I do a GET of the end state of a similar issue I get, the following content with the description field of the issue


```
{
"type": "mediaSingle",
"attrs": {
"layout": "center"
},
"content": [
{
"type": "media",
"attrs": {
"id": "df51bfa5-6a56-4846-8ee4-c5e08313d741",
"type": "file",
"collection": "jira-39581-field-description",
"width": 200,
"height": 183
}
}
]
}
```
The issue is I am am not sure how to create or update an issue with this content in my description. For an input I would only have the attached image for example: "example.png" which is attached. Some of the fields in the GET id and collection are render magically somewhere.

Any one have success including a thumbnail via the REST API. To clarify, the thumbnail to include in the issue description is successfully attached to the issue.

 

Cross posted: https://community.developer.atlassian.com/t/picture-thumbnail-through-jira-rest-cloud-api/37967

1 answer

1 accepted

0 votes
Answer accepted
Pete Dunham May 6, 2020

For anyone running into the same issue version 2 of the rest API lets you enter a string directory into the description field, which solves this problem.

Pete Dunham May 6, 2020

Borrowing from:https://community.atlassian.com/t5/Jira-questions/Wiki-style-renderer-image-formatting-not-working-via-REST-api/qaq-p/1005705

did work. Note that it is api/2 an don't api/3

curl --request PUT \
--url 'https:// example .atlassian.net/rest/api/2/issue/SCRUM-11' \
--header 'Authorization: Basic [redacted]' \
--header 'Content-Type: application/json' \
--data '{"fields": {"description": "Lorem ipsum !https://upload.wikimedia.org/wikipedia/commons/f/f8/Science_2.0_model.png!"}}

Suggest an answer

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

Atlassian Community Events