0

我想在我的工件中搜索所有具有某些属性的工件-

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

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

4

3 回答 3

1

这是一个例子:

遵循 AQL 查询

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

可以翻译成这个 REST 调用

http://localhost/artifactory/api/search/artifact?name=*jar&re
pos=jcenter-cache
于 2020-11-29T13:16:04.460 回答
0

使用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"
      ]
    }
  }
]
于 2020-11-29T14:02:58.027 回答
0

您可以使用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\"}})"
于 2020-12-02T10:30:21.597 回答