Search code examples
restartifactory

Update Artifactory properties - No properties could be found


I am able to retrieve the property set in one of the directory in Artifactory with REST

curl -u <username> -xget "<path_to_a_folder>/?properties=retention.days"

Output

{
  "properties" : {
    "retention.days" : [ "730" ]
  },
  "uri" : "<path_to_a_folder>"
}

But when I try to update retention.days, it return not found error Is my REST request incorrect?

curl -u <username> -xpatch "<path_to_a_folder>/?properties=retention.days=365&recursive=0"

Output

{
  "errors" : [ {
    "status" : 404,
    "message" : "No properties could be found."
  } ]
}

Solution

  • I think you are using Patch which does not seem be expected. It should be PUT. I have a set a value 300 for the parameter retention.days. GET shows the below result.

    curl -uadmin:"Password" -X GET "http://localhost:8082/artifactory/api/storage/example-repo-local/folder1/folder2/?properties=retention.days"
    {
      "properties" : {
        "retention.days" : [ "300" ]
      },
      "uri" : "http://localhost:8082/artifactory/api/storage/example-repo-local/folder1/folder2"
    }%
    

    Now I used the bleow command to reset this value.

    curl -uadmin:"Password1" -X PUT "http://localhost:8082/artifactory/api/storage/example-repo-local/folder1/folder2/?properties=retention.days=200&recursive=1"
    

    This recursively set the value to 200. If I try to set it now.

    "properties" : {
        "retention.days" : [ "200" ]
      }
    

    Give a try with this command.