I want to search for all the artifacts in my artifactory that have some property filed-
items.find({"@some_property" : {"$eq" : "some_value"}})
How can I do it while using REST API?
Here is an example:
Following AQL query
items.find(
{
"repo":{"$eq":"mymavenrepo"},
"name": {"$match" : "*.jar"}
}
)
can be translated to this REST call
http://localhost/artifactory/api/search/artifact?name=*jar&re
pos=jcenter-cache
Easier with JFrog CLI :
jfrog rt s '*' --props some_property=some_value
Example results:
[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"
]
}
}
]
You can use the AQL REST API method, for example:
curl -uuser:password -H "content-type: text/plain" -XPOST http://localhost:8081/artifactory/api/search/aql -d "items.find({\"@foo\" : {\"\$eq\" : \"bar\"}})"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.