list all artifacts in a repository on JFrog Artifactory

白昼怎懂夜的黑 提交于 2019-12-04 07:09:52

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)
user6136315

This is also working for me. Either you can write the command as specified by @JBaruch or you can run the JSON AQL file.

curl -u uname -X POST http://host:8081/artifactory/api/search/aql -H "content-type: application/json" -d @filename.aql

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!