A Little About AQL and Content-Type Headers

JFrog Support
2023-01-22 11:09

To properly execute an AQL query using aREST API call, it’s important to add a content-type header to the command. Here’s an example:

items.find(
{
"repo": {"$eq" : "libs-release-local"}
}
)

This query will return information on all artifacts residing in the libs-release-local repository.

If your AQL query is on a .json file (named example.json), it will look like this:

curl -u -i -X POST http://localhost:8081/artifactory/api/search/aql -H "content-type: application/json" -T example.json

If your query is being made via a cURL command, it should look like this:

curl -u -i -X POST http://localhost:8081/artifactory/api/search/aql -H "Content-Type: text/plain" -d ‘items.find({ "repo": {"$eq" : "libs-release-local"}})’

Published: Oct. 6, 2016
Last updated: Jan. 7, 2021

Keywords: AQL, REST API