Adding Images to Jira Issue Descriptions via API
The Problem
Adding images to Jira issue descriptions via API can be challenging due to the complexity of Atlassian Document Format (ADF) and media handling.
Simple Solution
Instead of using Jira’s complex media API, we can use a simpler approach:
- Upload the image as an attachment using
/rest/api/3/issue/{issueKey}/attachments
- Get the attachment URL
- Use the URL in an ADF structure to embed in the description
// Example ADF structure
{
"version": 1,
"type": "doc",
"content": [{
"type": "mediaSingle",
"attrs": { "layout": "center" },
"content": [{
"type": "media",
"attrs": {
"type": "external",
"url": "your-attachment-url"
}
}]
}]
}
This approach:
- Works with any programming language
- Uses standard Jira REST API v3
- Preserves existing description content
- Avoids complex media API validation issues
Solution by: Rron Haxhiu (GitHub: @rronhaxhiu_)