2
votes

Reading this API guide. My Artifactory version is 4.12.2. https://www.jfrog.com/confluence/display/RTF/Artifactory+REST+API#ArtifactoryRESTAPI-ItemProperties

It says to deploy an artifact like so.

curl -u myUser:myP455w0rd! -X PUT "http://localhost:8081/artifactory/my-repository/my/new/artifact/directory/file.txt" -T Desktop/myNewFile.txt

That works fine but I also want to add properties to file.txt while also uploading. I did see a separate API to set properties.

PUT /api/storage/libs-release-local/ch/qos/logback/logback-classic/0.9.9?properties=os=win,linux;qa=done&recursive=1

That works. I thought maybe it would work to do this.

curl -u myUser:myP455w0rd! -X PUT "http://localhost:8081/artifactory/my-repository/my/new/artifact/directory/file.txt?properties=os=win,linux;qa=done&recursive=1" -T Desktop/myNewFile.txt

It didn't work. Is it possible to upload an artifact and simultaneously set properties or does it have to be two different API calls?

I do use jfrog cli but I need an API solution.

1

1 Answers

6
votes

The correct format would be something like:

curl -u myUser:myP455w0rd! -X PUT "http://localhost:8081/artifactory/my-repository/my/new/artifact/directory/file.txt;propertyA=valueA;propertyB=valueB" -T Desktop/myNewFile.txt

You can find the relevant documentation here (I agree that it was "well hidden")