Alfresco REST Core API update Version metadatas

298 views Asked by At

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?

2

There are 2 answers

0
CHHIBI AMOR On BEST ANSWER

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();
3
Arjun On

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