问题
I'm running into an issue where I'm not able to get any of the queries I'm making on the build domain object to return when using AQL
When I make the following curl:
curl -X GET -H "X-JFrog-Art-Api: myArtifactroyKey" -H "Cache-Control: no-cache" "https://MyArtifactoryServer/artifactory/api/build/"
I get a set of results:
{
"builds": [
{
"uri": "/someBuild",
"lastStarted": "2017-02-15T22:02:49.066+0000"
},
{
"uri": "/someOtherBuild",
"lastStarted": "2017-02-15T21:45:09.590+0000"
},
"uri": "/someThirdBuild",
"lastStarted": "2017-02-15T21:17:38.794+0000"
}
],
"uri": "https://myArtifactoryServer/artifactory/api/build"
}
so I know that there are builds in my Artifactory
however, when I make the following curl, which I believe to be requesting all builds with any name, I get no results
curl -X POST -H "X-JFrog-Art-Api: myArtifactroyKey" -H "Content-Type: application/x-www-form-urlencoded" -H "Cache-Control: no-cache" -d 'builds.find({"name": {"$match":"*"}})' "https://MyArtifactoryServer/artifactory/api/search/aql"
returns:
{
"results": [],
"range": {
"start_pos": 0,
"end_pos": 0,
"total": 0
}
}
I've been able to get results when using items.find()
but have not had any luck with builds.find()
Is there something that I'm missing?
My overall intention is to have a Query that returns the most recent build information of a specific build based on the name but I have been unable to get even the most simple of Query against the build domain object to work.
Thanks in advance for the help.
回答1:
The answer might be related to permissions. If the API key you are using belong to a non admin user than it can explain the situation.
Querying the build domain using AQL requires admin permissions, while the "All Builds" API only requires a privileged user.
来源:https://stackoverflow.com/questions/42262029/aql-build-domain-object-does-not-return-results