artifactoryartifactory-query-lang

How to return Package name and Checksum in AQL


I am using a JSON file to populate my query that looks something like this:

{
  "files": [
    {
      "aql": {
        "items.find": {
          "repo": "my-fake-repo",
          "path": {"$match": "my-fake-path"}
         }
        }
      }
    ]
}

I would like to include only the name of the files in that repo and their sha256 sum. I've tried to use the .include() option, but it's not working for me. Any guidance on where to add the .include() tag with this structure? Again, using a JSON file to run jfrog rt s --spec option.


Solution

  • You can use the following syntax to get the SHA values of the artifacts within a repository.

    curl -u testuser:testpassword -X POST -H "Content-Type:text/plain" -d 'items.find().include("name","actual_sha1","actual_md5","sha256")' http://art.local/artifactory/api/search/aql
    
    {
        "results" : [ {
          "name" : "log4j-core-2.15.0.jar",
          "actual_md5" : "81e0433ae00602c0e4d00424d213b0ab",
          "actual_sha1" : "ba55c13d7ac2fd44df9cc8074455719a33f375b9",
          "sha256" : "419a8512895971b7b4f4f33e620d361254e5c9552b904b0474b09ddd4a6a220b"
        },{
          "name" : "log4j-core-2.15.0.pom",
          "actual_md5" : "41625b02e58659e1ca93934cfae05adc",
          "actual_sha1" : "6981c8f221fc6aba9797bb119b113eb392df6b2d",
          "sha256" : "7c74c42fd7abae9ba61068ea11fb2a65f13407704994bb65fb57916c96cdc75c"
        },{
          "name" : "maven-metadata.xml",
          "actual_md5" : "085d0609db2dc21acd69e92e49d4536e",
          "actual_sha1" : "e7265bab56759973893a1942a9cb1d70ed624c79",
          "sha256" : "8b973243eedee7eb8708f305f1cf8215bf57714167545eb6a3c2a98891d43677"
        } ],
        "range" : {
          "start_pos" : 0,
          "end_pos" : 3,
          "total" : 3
        }
    }