1
votes

I'm trying to update the property of an artifact(In my case sample text file)

I tried the API https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API#ArtifactoryRESTAPI-UpdateItemProperties

this is what I tried:

curl -X PATCH -uadmin:password -H '"props":{"ccs_x1_version": "7.7.7.7"}' "http://XXXXXXXXX:8081/artifactory/maven-dev-local/com/test/sbom/2.0.0-SNAPSHOT/sbom-2.0.0-20180704.094719-1.txt"

but was not successful, as command returns nothing, can someone help me in figuring out the right usage.

1

1 Answers

3
votes

Looks like you're missing the API endpoint for using the UpdateItemProperties. You're also sending the data as malformed JSON as a header rather than data.

You need to add the endpoint: /api/metadata/ and reformat your data to a proper JSON.

{ "props" : { "ccs_x1_version": "7.7.7.7" } }

According the the link provided:

Since: 6.1.0

Security: Requires a privileged user (Annotate authorisation required)

Usage: PATCH /api/metadata/{repoKey}/{itemPath}?[&recursive=1]

Produces: application/json

Sample Usage:

PATCH /api/metadata/libs-release-local/org/acme?[recursive=1] { "props":{ "newKey": "newValue", "existingKey": "modifiedValue", "toBeRemovedKey": null } }

If you update your request to curl -X PATCH -uadmin:password -d '{"props":{"ccs_x1_version": "7.7.7.7"}}' "http://XXXXXXXXX:8081/artifactory/api/metadata/maven-dev-local/com/test/sbom/2.0.0-SNAPSHOT/sbom-2.0.0-20180704.094719-1.txt"

This is also a new rest endpoint which is only available with the latest version of artifactory 6.1.0. If you're running an older version you're going to have to use the previous endpoint (Set Item Properties) in the official JFrog Documentation.

This is formatted curl -X PUT -uadmin:password "http://XXXXXXXXX:8081/artifactory/api/storage/maven-dev-local/com/test/sbom/2.0.0-SNAPSHOT/sbom-2.0.0-20180704.094719-1.txt?properties=ccs_x1_version=7.7.7.7"