0

I want to update the metadata of a specific version of a file in Alfresco.

How can I update node version metadatas using Alfresco REST API ?

In This endPoint : [ base url: /alfresco/api/-default-/public/alfresco/versions/1 , api version: 1 ] I can't find any method to do it ?

Do you have a webscript that allows you to update version information without incrementing it?

CHHIBI AMOR
  • 1,186
  • 2
  • 13
  • 27

2 Answers2

1

Please update the below properties to false in alfresco-global.properties. Make sure to restart tomcat after making properties file.

Note that, if you already have a file which has autoversions then they will continue to get auto version . Try new files after making property file changes. Or else remove cm:autoVersion, cm:initialVersion properties from existing files or reset the values to false:

cm:autoVersion=false cm:initialVersion=false

version.store.initialVersion =false
version.store.enableAutoVersioning =false
version.store.enableAutoVersionOnUpdateProps =false
Arjun
  • 624
  • 2
  • 6
  • thank you, But I want to know how I can do the update with a webscript or REST API. – CHHIBI AMOR Mar 30 '21 at 08:03
  • You can make the property changes first in alfresco and then run the rest api, it won't update the version – Arjun Mar 30 '21 at 13:50
  • Also you can remove the cm:versionable aspect after updating through your rest api, this is also a way to avoid version increment. – Arjun Mar 30 '21 at 13:59
0

I was able to do it with a webscript.

function main()
{
              
               logger.info("webscript modification d'une version d'un fichier")
               var parentNode = search.findNode("workspace://SpacesStore/"+uuid);
               var versionNode = parentNode.getVersion(version);
              
               var node = search.findNode("workspace://version2Store/" + versionNode.getVersionProperty('node-uuid'));
              
               logger.info(node.getProperties());
               node.getProperties()['{custom.model}etat']="Obsolete";
               //var node = versionNode.getNode();
               node.save();
               logger.error(node.getProperties()['{custom.model}etat']);
}
main();
CHHIBI AMOR
  • 1,186
  • 2
  • 13
  • 27