How do I use Artifactory Query Language to get the contents of my Archive

Starting from Artifactory 4.2.0 new primary Domains were exposed on AQL and can be used when querying for data in Artifactory.


One of the new domains is ‘Archive’.


Let’s say we want to get a file inside of an archive. Instead of downloading the entire archive to search for the file, we can first check the archive’s contents and if the file is there first.


Artifactory provides the ability to browse the content of archived artifacts.

This is enabled by default (This can be changed by editing the mimetypes.xml file which is located under $ARTIFACTORY_HOME/etc/ with the ‘archive’ MIME type).


Assuming that this feature is enabled, the ‘Archive’ domain will be enabled as well.

We will use the following query to get the archive’s content


archive.entries.find(

{

“archive.item.repo”:{“$eq”:”<repo name>”},

“archive.item.name”:{“$eq”: “<archive name>”}

}

)


If the file is in the archive, we can use the following REST call to download it from the archive.