I am using curl for downloading the latest artifactory from the repository and then want to download it to my server.. How can I achieve that. I am using the following command for getting AQL.
curl -u 'uname:pwd' -X PUT https://testrepo.test.test/artifactory/api/search/aql -d 'items.find ({"repo":"snapshots"},{"name":{"$match":"test*.war"}}).sort({"$desc" : ["created"]}).limit(3)' -H "Content-Type: text/plain"
Following is the AQL I get -
{ "results" : [ { "repo" : "snapshots", "path" : "******-SNAPSHOT", "name" : "*****.war", "type" : "file", "size" : 63059101, "created" : "2018-05-31T08:39:11.353-05:00",
"created_by" : "***_user", "modified" : "2018-05-31T08:39:09.724-05:00", "modified_by" : "****_user",
"updated" : "2018-05-31T08:39:09.724-05:00" } ], "range" : {
"start_pos" : 0, "end_pos" : 1, "total" : 1, "limit" : 3 } }
How can I download the artifacts by parsing this AQL using Curl?
You can use JFrog CLI, which is free CLI tool by JFrog. By doing so you can "ask" the CLI to download the artifact/s base on an AQL search, which means that all you have to do is specify the same AQL query and the CLI will resolve it for you.