如何使用 REST API 从 jfrog artifactory 中查找具有特定 属性 值的工件

how to find artifacts from jfrog artifactory that have a specific property value using REST API

我想在我的人工制品中搜索所有具有 属性 归档的人工制品-

items.find({"@some_property" : {"$eq" : "some_value"}})

如何在使用 REST 时做到这一点 API?

这是一个例子:

以下 AQL 查询

items.find(
 {
 "repo":{"$eq":"mymavenrepo"},
 "name": {"$match" : "*.jar"}
 }
)

可以转换为此 REST 调用

http://localhost/artifactory/api/search/artifact?name=*jar&re
pos=jcenter-cache

使用 JFrog CLI 更容易:

jfrog rt s '*' --props some_property=some_value

示例结果:

[Info] Searching artifacts...
[Info] Found 1 artifact.
[
  {
    "path": "generic-local/hello",
    "type": "file",
    "size": 6,
    "created": "2020-11-29T14:00:18.410Z",
    "modified": "2020-11-29T14:00:18.222Z",
    "sha1": "f572d396fae9206628714fb2ce00f72e94f2258f",
    "md5": "b1946ac92492d2347c6235b4d2611184",
    "props": {
      "some_property": [
        "some_value"
      ]
    }
  }
]

您可以使用 AQL REST API 方法,例如:

curl -uuser:password -H "content-type: text/plain" -XPOST http://localhost:8081/artifactory/api/search/aql -d "items.find({\"@foo\" : {\"$eq\" : \"bar\"}})"