0
votes

When ever I run the curl command it's throwing a syntax error. I've followed this documentation to list all artifacts in 'war-release' repo. No idea what's the issue.

$curl -u uname:password -X POST https://<artifactory.com>/artifactory/api/search/aql -d items.find({"repo":"war-release"})

-bash: syntax error near unexpected token `('

3

3 Answers

6
votes

Another option that doesn't requires to enclose the query with " or ' and works in most environments is to save the query to file, lets call it aql.query

items.find(
     {
          "repo":"war-release"
     }
)

and then run the following curl command from the same directory that contains the aql.query file (don't forget to replace the templates in the command with your user name, password, host and port).

curl -X POST -uuser:password 'http://host:port/artifactory/api/search/aql' -Taql.query

2
votes

Try this curl statement:

curl -u uname:password -X POST -d "items.find({"repo":"war-release"})" https:///artifactory/api/search/aql

2
votes
curl -X POST -k -u user:pwd 'https://xxx/artifactory/api/search/aql' -d 'items.find({"repo":"repo-local"})' gives json output.

use single quotes -- This worked for me fine