Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to get filename from media node id

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.

1 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

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Jira Software

Presenting the "Best of 2020" Jira Software roundup!

Catch up with Atlassian Product Managers in our 2020 Demo Den round-up! From Advanced Roadmaps to Code in Jira to Next-Gen Workflows, check out the videos below to help up-level your work in the new ...

4,922 views 6 15
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you