How to get last uploaded attachment from a JIRA issue with JIRA REST GET URI (JIRA Query Language)

Dear All,

I have two questions. If you could help me with any one of those, I would be very grateful.

1) I have few criteria to search a particular issue. Now I want to get the last updated attachment information from that issue. The issue have number of other attachments in .csv format. However, I want only the last uploaded one. Is there any function or reference keyword in the JQL to achieve the same.

2) Also could you please let me know how do I access the nested child elements of attachments and get a restricted JSON response with only intended attachments attribute.

Example: 

Issue: {

Fields:

{

  Status:

  Issue Type:

  Attachments:

{

id:

created:

content:

self: // I want the JSON response against the GET query results me only the four attributes, id, created, content and self url.

........................................................

......................................................

}

}

 

 

1 answer

0 votes

In regards to part #1, there is a problem with this approach.  Jira's JQL is designed to search for Jira issues.  Meaning that JQL is designed to return Jira issues.  It's not designed to return the attachments contained within these issues natively. 

Jira's native JQL does have a "Attachments" field you can search in JQL.  But these only can be used search for whether an issue in Jira has an attachment or not.  It can't be used to search for the latest attachment on that issue.   So in regards to your first part, there is not a way to do this natively with Jira.

That said, you might be able to use a plugin in Jira to add some more of this kind of functionality.  There are a number of add-ons for Jira that extend the functionality around attachment management.  I would recommend searching our marketplace to find these: https://marketplace.atlassian.com/search?product=jira&query=attachment

From this list of plugins I found this one: https://marketplace.atlassian.com/plugins/com.infosysta.jira.JAM/server/overview

It appears that the use of this plugin adds new JQL functions that can extend the searching for attachments in Jira.   While this isn't exactly what I think you are looking for, this plugin would allow you to at least search specifically for attachments added between certain time periods.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Thursday in Jira

Continuous visibility with the new Jira Software Cloud and Bitbucket Cloud integration

Hey Atlassian community, I am a PM on the Bitbucket Cloud team and I am excited to share that we just released an improvement to the Jira Software and Bitbucket Cloud integration. With the newly im...

75 views 0 3
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you