ARTIFACTORY: How to read the properties of non-cached artifacts in a smart remote repository?

Fadi Rouhana
2022-09-12 10:16

Users may, in certain circumstances, be required to inspect the details of an artifact before caching it from the Artifactory smart remote repository. This can be helpful in a variety of situations, such as when you need to go through certain properties of an item to determine whether you want to resolve it. In case you attempt to get the properties of an artifact that is not currently stored in the cache using a simple cURL command, you will be prompted with the following 404 error:curl -XGET "http://JFROG_URL/artifactory/smart-maven-remote/org/jfrog/test/multi2/3.7-SNAPSHOT?properties" -u<USER>
  "errors" : [ {
    "status" : 404,
    "message" : "OK"
  } ]

From version 7.17.4, Artifactory provides the ability to query remote repositories using AQL (Artifactory Query Language – JFrog) in which you can search directly within remote or virtual repositories.

This requires providing credentials to the remote Artifactory on the remote repository configuration under the Advanced tab.

To enable a search within a remote repository, add the transitive tag to the search query:

items.find(“repo”: “remote-repo”).transitive()

  • The following rules and guidelines apply when searching remote and virtual repositories:
  • The remote repository MUST be an Artifactory instance.
  • The query MUST include a single repository and a $eq clause.
  • You cannot use Sort and Offsetflags within the AQL Query.
  • The primary domain can only contain Items.
  • Include may only have the following domains: Items and ItemProperties.
  • The search will run on the first five remote repositories within the virtual repository.

For example, the following example searches for all the names and properties on items residing in a certain smart remote repository:curl -XPOST https://<JFROG_URL>/artifactory/api/search/aql -H 'Content-Type: text/plain' -d 'items.find({"repo": "<REMORE_REPOSITORY_NAME>"}).include("name", "property.*").transitive()' -u<USER>
For more information, you may refer to the following Wiki page.