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

This widget could not be displayed.

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
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

281 views 5 0
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