Hello,
I am trying to use:
jira-url/rest/api/2/search?jql=project%20%3D%20abc%20and%20issuefunction%20in%20hasAttachments(txt)&fields=attachment
and this returns a list of all the attachments of the issues found by that query.
Could I filter out the returned attachments by their attributes (preferably by name or type)?
Current output:
{"expand":"operations,versionedRepresentations,editmeta,changelog,renderedFields","id":"858847","self":"jiraurl/rest/api/2/issue/858847","key":"abc-476","fields":{"attachment":[{"self":"jiraurl/rest/api/2/attachment/612554","id":"612554","filename":"20200712_JIRA_Clean-up_steps_copy.txt","author":{"self":"jiraurl/rest/api/2/user?username=mihai","name":"mihai","key":"mihai","emailAddress":"test@h.com","avatarUrls":{"48x48":"jira/secure/useravatar?ownerId=mm&avatarId=21065","24x24":"j/secure/useravatar?size=small&ownerId=mm&avatarId=21065","16x16":"j/secure/useravatar?size=xsmall&ownerId=mm&avatarId=21065","32x32":"j/secure/useravatar?size=medium&ownerId=mm&avatarId=21065"},"displayName":"Mihai","active":true,"timeZone":"Europe/Berlin"},"created":"2020-07-15T05:57:06.000+0000","size":3424,"mimeType":"text/plain","content":"jira/secure/attachment/612554/20200712_JIRA_Clean-up_steps_copy.txt"}]}},
{"expand":"operations,versionedRepresentations,editmeta,changelog,renderedFields","id":"219662","self":"jiraurl/rest/api/2/issue/219662","key":"abc-36","fields":{"attachment":[{"self":"jiraurl/rest/api/2/attachment/158387","id":"158387","filename":"InactiveUser_19June2017.txt","author":{"self":"jiraurl/rest/api/2/user?username=mihai","name":"mihai","key":"mihai","emailAddress":"test@h.com","avatarUrls":{"48x48":"jj/secure/useravatar?ownerId=mm&avatarId=14700","24x24":"j/secure/useravatar?size=small&ownerId=mm&avatarId=14700","16x16":"j/secure/useravatar?size=xsmall&ownerId=mm&avatarId=14700","32x32":"j/secure/useravatar?size=medium&ownerId=mm&avatarId=14700"},"displayName":"Mihai","active":true,"timeZone":"Europe/Vaduz"},"created":"2017-06-19T01:38:41.000+0000","size":1340,"mimeType":"text/plain","content":"jira/secure/attachment/158387/InactiveUser_19June2017.txt"}]}}]}
Preferred output: only the attachment thathas " inactiveUser" in name.
Thank you!
There isn't a native method for searching attachments (ex: by name, extension, content, etc.) in JQL. JQL only natively supports the ability to query if an issue has attachments (which you're aware of). That being said, there are a number of Marketplace apps (for both Cloud and Server/DC) that provide content + metadata indexing and extend JQL search/filter functionality.
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.