What is the best way to search for artifacts?

Assuming that you are working with Artifactory 3.5 and above, the best and most flexible way for you to search for artifacts would be to use AQL via our REST API.

 

Using cURL, you would provide a command based on the following template:

curl -X POST “http://<artifactory url>:<artifactory port>[/artifactory]/api/search/aql” -T <aql json file> -u <admin-user>[:<password>]

 

Replacing all of the “<your content here>” sections with something that seems like actual content, your command might look something like this:

curl -X POST “http://artifactory.mycompany.com:8081/artifactory/api/search/aql” -T aql.json -u myadmin:myadminPassw0rd

This assumes the following:

  • You’re hosting artifactory at “artifactory.mycompany.com” on port 8081

  • Artifactory is accessible via “/artifactory” from the container root.

  • Your AQL json content is in a file named “aql.json”, located in the same directory where you are running the command

  • You have a user with administrative privileges named “myadmin”, with password “myadminPassw0rd”. It is possible to use AQL without an admin user, but the functionality is greatly reduced.

  • You do not actually have to provide the password in the command. You will be prompted for it if you do not include it as part of the command.

 

Now then, the content of the “aql.json” file would look something like what you see in these examples. The simplest content would be a single line: “items.find()”, which returns all of your artifacts, with no filtering and no special content (like properties).


We’ll leave it to you to look over the documentation and tinker with the various ways that AQL can be used to meet your needs.

If you have specific questions/requirements, please ask us.