restalfrescocmisalfresco-webscriptsalfresco-enterprise

Alfresco REST Core API update Version metadatas


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?


Solution

  • 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();