Access versioning information through Java API

Hi!

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 :-)

0 votes

2 answers

165 views

ANSWER



Hello,

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

Regards.

0 votes



Hello,

You can:

  • Use the Document.Version automation operation.
  • Use the X-Versioning-Option HTTP header with major or minor value to version a document with the PUT method on the Document ID

Regards

0 votes