Access versioning information through Java API
I'm coding an application that stores documents in Nuxeo using Java API. I figured out how to create additional versions of a document through
doc.setPropertyValue("file:content", batchUpload.getBatchBlob()); doc = repository.updateDocument(doc);
and I can see using Web UI that it worked. Now, how can I access through the API the information in the screenshot below, like number of versions, timestamp, author,… And retrieve a particular version ?
Thanks in advance for your help :-)
You can indeed use the automation operation or the header that Greg proposed to manually version a document. In your case, it seems that the automatic versioning is triggered.
Once you have a version, you can use the operation
Document.GetVersions to get a list of versions for the given document, usage is such as below:
Documents versions = nuxeoClient.operation("Document.GetVersions").input("ID_OR_PATH").execute();
- Use the
- Use the
X-Versioning-OptionHTTP header with major or minor value to version a document with the PUT method on the Document ID