Artifactory API example: Setting properties on an existing artifact

Here’s another somewhat more elusive Artifactory API example. Setting the properties on an existing artifact was somewhat troublesome at first. Quick testing shows that the only thing to be concerned of is URL encoding for spaces and many characters. You’ll need to be sure your user has annotate permissions to the target in order to not receive a HTTP 401/403 error. Oh, and if you need to include equal symbols within the keys or values themselves, escape them with a backslash \=.

https://gist.github.com/gravcat/526053cafa7e95e450ca

The above example would set file.zip with the following properties:

‘foo’ = ‘bar’

‘a spaced key’ = ‘somevalue’

‘version’ = ‘1.2.3.4’

‘someweird=value’ = ‘foo=bar’

 


So, what do you think ?