user6136315
user6136315

Reputation: 705

list all builds(artifacts) in a repo on jfrog-artifactory using AQL(artifactory query language)

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 `('

Upvotes: 0

Views: 17471

Answers (4)

hoppfrosch
hoppfrosch

Reputation: 661

To get a proper answer, you should use a content-type:

curl -X POST -k -u user:pwd -H "content-type: text/plain" 'https://xxx/artifactory/api/search/aql' -d 'items.find({"repo":"repo-local"})'

See: https://jfrog.com/help/r/artifactory-a-little-about-aql-and-content-type-headers/a-little-about-aql-and-content-type-headers

Upvotes: 0

Springhills
Springhills

Reputation: 386

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

Upvotes: 2

Gidi.S
Gidi.S

Reputation: 171

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

Upvotes: 6

johnnywhoop
johnnywhoop

Reputation: 974

Try this curl statement:

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

Upvotes: 3

Related Questions