cancel
Showing results for 
Search instead for 
Did you mean: 

How to upload new version of file using its file id by REST

hari
Star Contributor
Star Contributor
Hello Everyone,

I was able to upload the files using REST with "/alfresco/service/api/upload/?alf_ticket="+authTicket.
Now when I upload the same file again using the above url pattern, its getting uploaded as a new version but I have a problem here.

I am storing my files in the following folder structure under the site's document library - year/month/doctype/<my files go here>
Now when I want to upload a new version for a file uploaded in November, it creates a new file in December folder since its December now.

Hence I would like to know how we can upload a newer version of file using the DocumentID using REST API.

Thanks,
Hari.
2 REPLIES 2

hari
Star Contributor
Star Contributor
For uploading a new version of the old file, we have to give the file id to the updatenoderef as below and just remove the site, container and uloaddirectory options.


Part[] parts = {
   new FilePart("filedata",filename,fileobj,filetype,null),
   new StringPart("filename", filename),
   new StringPart("description", description),
   new StringPart("updatenoderef", "workspace://SpacesStore/51ae96a1-17fe-4b8e-84fc-68b6700b591c"),
};

luharry
Champ on-the-rise
Champ on-the-rise

hello ,  how can you do that uploading the files using REST with "/alfresco/service/api/upload/?alf_ticket="+authTicket.  Please help me ,than you very much.