Page 1 of 1

Updating a document via Restful API or database

Posted: Wed Mar 22, 2017 4:50 pm
by rdovell
I am working on importing a large number of documents from another document management solution, some of these documents have a few versions that need to be preserved.

Using the restful API, I am able to upload a document but receive an ItemExistsException when trying to upload a different document with the same save path. Is there a way that I can add a new version of a document over an existing one using the Restful API?

Re: Updating a document via Restful API or database

Posted: Wed Mar 22, 2017 5:37 pm
by rdovell
I figured it out, here are the relevant curl commands for someone else:

You need to checkout the document, then check it back in which increments the version number by 0.1

Checkout command:
curl -u okmAdmin:admin -H "Accept: application/json" http://localhost:8080/OpenKM/services/r ... 4e780fae3a

Checkin command(If you have a file in the local directory called 'foobar.txt'
curl -u okmAdmin:admin -H "Accept: application/json" -X POST -F docId="afc7b0cd-d0ab-4920-8b5d-d64e780fae3a" -F content=@foobar.txt http://localhost:8080/OpenKM/services/r ... nt/checkin

Re: Updating a document via Restful API or database

Posted: Thu Mar 23, 2017 9:25 pm
by jllort
If you wait for the next week we will release a migration tool what can be extended for this purpose.