The VersionService service displays the following operations:
promote: to create a version of a documentgetVersions: to retrieve document versionsrevert: to restore a version of a documentdeleteVersion: to delete a version of a documentdeleteVersions: to delete all versions of a document
Creating a version
The example below shows how to create a version of a document.
# <CORE_HOST> FlowerDocs Core base URL
# <TOKEN> authentication token
# <DOCUMENT_ID> document identifier
# <LABEL> version name
curl -X POST "<CORE_HOST>/rest/documents/<DOCUMENT_ID>/versions" \
-H "token: <TOKEN>" \
-H "Content-Type: application/json" \
-d '"<LABEL>"'
@Autowired
private VersionService<Document> versionService;
public Document promote() throws TechnicalException, FunctionalException
{
Id id = new Id("documentId");
String label = "Version_1";
return versionService.promote(id, label);
}
Versions recovery
The example below shows how to recover versions of a document.
# <CORE_HOST> FlowerDocs Core base URL
# <TOKEN> authentication token
# <DOCUMENT_ID> document identifier
curl -X GET "<CORE_HOST>/rest/documents/<DOCUMENT_ID>/versions" \
-H "token: <TOKEN>"
@Autowired
private VersionService<Document> versionService;
public VersionSeries getVersions() throws TechnicalException, FunctionalException
{
Id id = new Id("documentId");
return versionService.getVersions(id);
}
Restoring a version
The example below shows how to restore a version of a document.
# <CORE_HOST> FlowerDocs Core base URL
# <TOKEN> authentication token
# <DOCUMENT_ID> document identifier
# <VERSION_ID> document version identifier
curl -X POST "<CORE_HOST>/rest/documents/<DOCUMENT_ID>/versions/<VERSION_ID>/revert" \
-H "token: <TOKEN>"
@Autowired
private VersionService<Document> versionService;
public Document revert() throws TechnicalException, FunctionalException
{
Id documentId = new Id("documentId");
Id versionId = new Id("versionId");
id versionId = new Id("versionId");
}
Version deletion
Deleting a version
The example below shows how to delete a version of a document.
# <CORE_HOST> FlowerDocs Core base URL
# <TOKEN> authentication token
# <DOCUMENT_ID> document identifier
# <VERSION_ID> document version identifier
curl -X DELETE "<CORE_HOST>/rest/documents/<DOCUMENT_ID>/versions/<VERSION_ID>" \
-H "token: <TOKEN>"
@Autowired
private VersionService<Document> versionService;
public void deleteVersion() throws TechnicalException, FunctionalException
{
Id documentId = new Id("documentId");
Id versionId = new Id("versionId");
return versionService.deleteVersion(documentId, versionId);
}
All versions deletion
The example below shows how to delete all versions of a document.
# <CORE_HOST> FlowerDocs Core base URL
# <TOKEN> authentication token
# <DOCUMENT_ID> document identifier
curl -X DELETE "<CORE_HOST>/rest/documents/<DOCUMENT_ID>/versions" \
-H "token: <TOKEN>"
@Autowired
private VersionService<Document> versionService;
public void deleteVersion() throws TechnicalException, FunctionalException
{
Id documentId = new Id("documentId");
return versionService.deleteVersions(documentId);
}