Hi @Angel --
So... I first looked at this question in the context of an external website/service where you might want to include an inline preview of an image from a Jira ticket:
Assuming that the user viewing the URL is logged into Jira, you could use the get issue API endpoint like this:
https://YOURSERVER.atlassian.net/rest/api/3/issue/BUG-11?fields=attachment
Which will return JSON that includes this link:
"thumbnail": "https://YOURSITE.atlassian.net/rest/api/3/attachment/thumbnail/10038"
Thumbnail images can be displayed inline.
The link to the actual image unfortunately has a the headers that cause browsers to interpret it as a download:
"content": "https://YOURSERVER.atlassian.net/rest/api/3/attachment/content/10038",
BUT!
Based on your other question about Smart Values, I'm going to guess that maybe you're trying to create an Automation that sends an email that includes an image?
Huh. I've never tried that. I'm guessing it will probably fail because the mail client will not be "logged in" to Jira, and so won't have permission to load the image.
All this is to say, we're going to need a little more context.
Thanks!
Hi @Darryl Lee
The use case is that a user would acces directly to an image by a customfield with this URL that shows in jira board, also the user had acces to the Jira site.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Interesting.
I tried it. Unfortunately when I pasted in the thumbnail endpoint, it opens the image in a separate tab.
Pasting in the content endpoint, clicking the link results in downloading the image.
When testing, something that I found interesting is the option to Edit cover image for a card:
Huh, I wonder if there's an API endpoint to set that...
Oh yeah, some graphql (not my favorite):
So... It's a POST to
https://MYHOST.atlassian.net/gateway/api/graphql/pq/abe9efd99e9999c999999999dea2ef69a762dba11ed3e40c03fbe7d13045a4c?operation=setCardCoverMutation
With this payload:
{operation
setCardCoverMutation
{"operationName":"setCardCoverMutation","variables":{"issueId":"ari:cloud:jira:CLOUD_ID:issue/10046","attachmentId":"10038"}}
Where 10046 is the ID of my Jira Issue, and 10038 is the ID of the attachment.
The big mystery is, WTF is abe9efd99e9999c999999999dea2ef69a762dba11ed3e40c03fbe7d13045a4c
(That's not actually the number. I've replaced some numbers.)
It seems to be consistent across different boards and projects. But seems unique to this particular operation. (Other graphql/pq calls have different IDs.)
It might be interesting to sniff your own mystery ID, and then after making the API calls to get the issue and attachment IDs, try making another API call to your unique API endpoint and see if it updates the image.
Here's how I do this kind of hackery to find the mystery ID:
Open up the Developer Panel in Chrome, then manually add an image to a card.
If you search in the Network tab for setcardcovermutation, then it should find the call that was made when you added an image.
If you click on that call, and look at the Payload tab, you can View source to see the graphql query, which is pretty straightforward:
References:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh yeah, have to be ok with having your board be full of images, like this, hehe:
(Sorry, random images I had in my Downloads/Desktop folder.)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.