list all artifacts in a repository on JFrog Artifactory
For me it worked when I used Content-Type text/plain instead of application/json, i.e.
curl -u uname -X POST http://host:8081/artifactory/api/search/aql -H "content-type: text/plain" -d @filename.aql
AQL is the way to go. And your query is almost good (you forgot the $match
for all the repos starting with war
or web
. The problem is curl. If you want to write the query string in the command line you need to escape all the inner "
and $
. Here's the working query:
curl -u uname:password -X POST -k https://artifactory.xxxx.com/artifactory/api/search/aql -d "items.find({\"type\" : \"file\",\"\$or\":[{\"repo\" : {\"\$match\" : \"war*\"}, \"repo\" : {\"\$match\" : \"web*\"} }]}).include(\"name\",\"repo\",\"path\",\"size\").sort({\"\$desc\": [\"size\"]}).limit(10)"
Now, this is hell. Instead, consider writing the query in a text file and passing it with -d @filename.aql
. In this case you don't need all the escaping and the query will look like:
items.find({
"type" : "file",
"$or":[{
"repo" : {"$match" : "war*"},
"repo" : {"$match" : "web*"} }]})
.include("name","repo","path","size")
.sort({"$desc": ["size"]})
.limit(10)