Hi,
I would like to ask you, how can I get filename or attachement id linked on document node media https://developer.atlassian.com/cloud/jira/platform/apis/document/nodes/media/
Documentation says, that from attrs.id I can get eg. filename, but its not written how, on which endpoint or whatever...
I spend almost an hour to find how to get this, but I found nothing.
Thanks anyone who will give me the answer.
Hi Rostislav,
All attachments in Jira are always bound to a specific issue in Jira. As such, we can find both the id and the filename of the attachments by doing a GET to the /rest/api/3/issue/{issueIdOrKey} endpoint and passing it the issuekey or the issue id number where that attachment is bound to. So for example, if my issuekey is SCRUM-123, and I know it has an image attached to that issue, I can do a REST call of
GET /rest/api/3/issue/SCRUM-123
and I'll get back something like this:
"attachment": [ { "id": 10000, "self": "https://your-domain.atlassian.net/rest/api/3/attachments/10000", "filename": "picture.jpg", "author": { "self": "http://your-domain.atlassian.net/rest/api/3/user?accountId=99:27935d01-92a7-4687-8272-a9b8d3b2ae2e", "key": "mia", "accountId": "99:27935d01-92a7-4687-8272-a9b8d3b2ae2e", "name": "mia", "avatarUrls": { "48x48": "http://your-domain.atlassian.net/secure/useravatar?size=large&ownerId=mia", "24x24": "http://your-domain.atlassian.net/secure/useravatar?size=small&ownerId=mia", "16x16": "http://your-domain.atlassian.net/secure/useravatar?size=xsmall&ownerId=mia", "32x32": "http://your-domain.atlassian.net/secure/useravatar?size=medium&ownerId=mia" }, "displayName": "Mia Krystof", "active": false }, "created": "2019-04-01T14:51:03.159+0000", "size": 23123, "mimeType": "image/jpeg", "content": "https://your-domain.atlassian.net/jira/attachments/10000", "thumbnail": "https://your-domain.atlassian.net/jira/secure/thumbnail/10000" } ],
Along with a lot more json data. But this section will tell us what attachments a Jira issue has, the attachment ids, and the attachment filenames.
I hope this helps.
Andy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
we also met the issue, after we migrated projects from server instance to cloud instance, we sync the attachments to cloud project, the attachment displayed in description and comments are failed, after checking with api, we found the good attachments in comment have a "occurrenceKey" key , but how to find the right occurrenceKey key for the attachment? we don't know that.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
One issue is that the ID in the API does not match the media id returned from the ADF media node? The media id is a GUID while the api returns an int?
{ "type": "media", "attrs": { "type" : "file", "id": "6e7c7f2c-dd7a-499c-bceb-6f32bfbf30b5", "collection" : "my project files" } }
Here is the problem I need to solve,
1) I have an issue with 10 inline images
2) Looping through the ADF I can find the media nodes easily .. but there is nothing that lets me connect the mediaNode to the image. Yes it renders in Jira correctly, but I need to output a report using the API and I can not figure out which image goes where?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.