Hi I am following this syntax https://jira.atlassian.com/secure/WikiRendererHelpAction.jspa?section=all&_ga=2.207440784.2044781420.1549987318-2128914256.1539369576
My markdown is coming through except for images. What is the correct format for inlining an image url via the REST api?
Thank you!
Which specific REST API endpoint are you using here?
I tried this with a comment endpoint and it seems to work correctly for me in Jira Cloud.
curl --request POST \
--url 'https:// example .atlassian.net/rest/api/2/issue/SCRUM-12/comment' \
--header 'Authorization: Basic [REDACTED tokenstring]' \
--header 'Content-Type: application/json' \
--data '{"body": "Lorem ipsum !https://upload.wikimedia.org/wikipedia/commons/f/f8/Science_2.0_model.png!"}'
In my case it did show a remote image as an inline comment in my Jira issue.
I am interested to learn more about what your comment/description/text field ends up looking like, what endpoint you're using here, and perhaps there is a problem with renderer for the field in question to display this info.
Thanks so much for the reply and sorry for the delay!
This does in fact work for the comment endpoint, but why does it not work for the description field? I have the wiki renderer set on that field.
Thanks again,
Jono
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jono,
I tried this again in my test since, this time to update a description field, and it worked for me. My syntax was:
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!"}}'
A few questions for you:
If you're using the same endpoint and same payload but still getting different results, then I would want to know more about your Jira Cloud site to try to understand what is different here.
Andy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for continuing to look!
I am using 3LO so my endpoint looks like this:
https://api.atlassian.com/ex/jira/[CLOUD_ID]/rest/api/3/issue
and my data payload looks like this (apologies for formatting and it's copied from my ruby code)
body = {
"fields" => {
"project" => {
key: params['project']['value'],
},
summary: params['summary'],
"description": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": desc
}
]
}
]
},
"issuetype": {
"id": params['issuetype']['value']
}
},
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jono,
Thanks for letting me know that. I think I have found out why at least I can do this, but your calls do not appear to be able to. I have been using the v2 version of the Jira Cloud REST API to make my changes. However you have been using the v3 version.
From the v3 about section:
Note that version 3 of the Jira Cloud platform REST API is in beta. All the endpoints from the version 2 API are available, however they are under development and may change. The main change from version 2 is the introduction of the Atlassian Document Format for a number of resources (for example, issue, comment, worklog).
In this case, the description field in v3 is considerably different than in v2. It appears to be utilizing the new Atlassian Document Format. Which, honestly, is new to me too.
This new format has a very different syntax for this. To figure out what the payload should look like I did a GET /rest/api/3/issue/SCRUM-11 This was my issue where I made the inline external image appear, but I used the v2 API to do that. I found in the results this payload about description:
"description":{"version":1,"type":"doc",
"content":[{"type":"paragraph",
"content":[{"type":"text","text":"Lorem ipsum "}]},
{"type":"mediaSingle","attrs":{"layout":"center"},
"content":[{"type":"media","attrs":
{"type":"external","width":200,"height":183,
"url":"https://upload.wikimedia.org/wikipedia/commons/f/f8/Science_2.0_model.png"}
}]}]},
With this info, I think can use this "mediaSingle" of type "external" to specify the external URL to appear in line in a description.
It's interesting to me that the v2 and v3 calls for this same endpoint will format this much differently, but they do. I hope this helps. Perhaps you can change the format of your v3 calls to match this syntax to make it work, OR is it feasible to utilize the v2 REST API endpoint here for creating/editing issues?
Andy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Discover how Atlassian is revolutionizing service management with cutting-edge solutions for AI-powered support, HR Service Management, or DevOps connectivity.
Register here ⬇️Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.