How to get specific property value in Artifactory

Viewed 3613

Is there a way using REST but avoiding aql to get specific custom property value in Artifactory. Artifact name, repo and property key are known. Get on artifact path does not show custom properties at all.

Any advice?

2 Answers

Simply try this:

curl --silent --show-error "http://your-artifactory-server:8081/artifactory/api/storage/my_repo/some_path1/some_path2/artifact_file.txt?properties 

it will output:

{
 "properties": {
     "prop1": [ "value1" ],
     "prop2": [ "value2" ],
     ...
     ....
  },
  "uri": "http://your-artifactory-server:8081/artifactory/api/storage/my_repo/some_path1/some_path2/artifact_file.txt"
}

If you wanted to get the value of a given property, then try this:

curl --silent --show-error "http://your-artifactory-server:8081/artifactory/api/storage/my_repo/some_path1/some_path2/artifact_file.txt?properties | grep "prop2" | sed "s/[\"\[ ,]//g;s/]//g" | cut -d':' -f2
Related