AQL and content-type headers

In order to properly execute the AQL query using REST api call, it is important to add a content type header on the command.


Let’s use the following AQL query as a model example:

items.find(

{

“repo”: {“$eq” : “libs-release-local”}

}

)

This query will return information on all artifacts which are in the ‘libs-release-local’ repository.

When the AQL query is on a .json file (named example.json):

curl -u<user> -i -X POST http://localhost:8081/artifactory/api/search/aql -H “content-type: application/json” -T example.json


If the query is in the curl command itself, it should look like this

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