Versioning
Versioning in Contendo Server allows multiple versions of a document to be maintained over time. This ensures that historical states of a document can be stored, accessed and restored if needed.
Versioned Objects
Only Documents support versioning. Other object types, such as Items, Folders, and Relationships, do not have versioning capabilities.
Each versioned document is part of a Version Series – a collection of all versions of the document. All documents in a single version series share the same Version Series ID. However, each version is technically a separate object with a unique Object ID.
The version format follows <major>.<minor>
, such as 1.0
, 1.1
, and 2.0
:
- The major part starts at
1
and increments with each major version. - The minor part starts at
0
for each major version and increments with every minor update within that major version. - A version with a
.0
minor part (<major>.0
) is considered a Major Version. - The highest major version of a document is the Latest Major Version.
- The highest combined major and minor version is the Latest Version.
A document is created as either a major or a minor version, depending on the Versioning State parameter:
major
- created as a major version with version1.0
.minor
- created as a minor version with version0.1
.
Versioning-Specific Properties
Documents have a set of versioning-related properties. These properties cannot be updated directly but are automatically managed during versioning operations.
Name | Required | Description | Link |
---|---|---|---|
cmis:isLatestVersion |
No | Indicates whether this document is the latest version. | Properties |
cmis:isMajorVersion |
No | Indicates whether this document is a major version. | Properties |
cmis:versionLabel |
No | The label of the document version. | Properties |
cmis:versionSeriesId |
No | The unique identifier for the version series of this document. | Properties |
cmis:isLatestMajorVersion |
No | Indicates whether this document is the latest major version. | Properties |
cmis:isPrivateWorkingCopy |
No | Indicates whether this document is a private working copy. | Properties |
cmis:versionSeriesCheckedOutId |
No | The identifier of the version series that is checked out. | Properties |
cmis:versionSeriesCheckedOutBy |
No | The user who checked out the version series. | Properties |
cmis:versionSeriesCheckedOutDate |
No | The date when the version series was checked out. | Properties |
Check Document Specific Properties for an overview on all properties available for documents.
Versioning Flow
Updating a document with any Update Operation won't automatically create a new version.
Creating a new version involves the following steps:
- Check-Out: Creates a Private Working Copy of the document, a temporary editable copy that is not yet a new version.
- Optionally, apply any updates to the Private Working Copy.
- Check-In: Saves the Private Working Copy as a new version. During check-in, the version label is incremented, and depending on parameters, either the major or minor version increases.
Alternatively, Cancel Check-Out discards any prepared changes and deletes the Private Working Copy.
Versioning Operations
Operation | Description |
---|---|
checkOut | Creates a private working copy for editing. |
checkIn | Saves a private working copy as a new version. |
cancelCheckOut | Discards a private working copy, reverting any changes. |
getAllVersions | Retrieves all versions of a document in a version series. |
Check Out
The checkOut
operation creates a Private Working Copy of a document - a temporary editable copy as preparation for
creating a new version. Checking out an earlier version of the document can be used to restore that version.
- Operation:
checkOut
- HTTP method:
POST
- Content-Type:
application/json
,multipart/form-data
- Target object: The document to be checked out. Using the path will check out the latest version. Using the objectId will check out the exact version to which the objectId belongs. See Specifying the Target Object.
Parameters
Name | Required | Description | Link |
---|---|---|---|
succinct |
No | If set to true , the response will be more compact. |
Succinct |
Example Request:
curl -X 'POST' \
'{REPOSITORY_URL}/Animals/Dogs/Rex' \
-H 'Content-Type: application/json' \
-d '{
"operation": "checkOut",
"succinct": true
}'
Response Format
- Content-Type:
application/json
- Response body: the JSON representation of the checked out Private Working Copy:
Field Name | Condition | Description | Link |
---|---|---|---|
properties |
succinct=false or succinct omitted |
The object's properties in detailed format. | Properties |
succinctProperties |
succinct=true |
The object's properties in concise format. | Succinct Properties |
Example Response - the Private Working Copy (omitted some properties for clarity):
{
"succinctProperties": {
"cmis:name": "Rex",
"cmis:objectId": "2f14b215-32ce-497d-bbea-e8e58c1971bc",
"cmis:objectTypeId": "dog",
"cmis:description": "Good Dog!",
"cmis:isPrivateWorkingCopy": true
}
}
Check In
The checkIn
operation saves a Private Working Copy as a new version.
- Operation:
checkIn
- HTTP method:
POST
- Content-Type:
application/json
,multipart/form-data
- Target object: The Private Working Copy to be checked in. See Specifying the Target Object.
Parameters
Name | Required | Description | Link |
---|---|---|---|
checkinComment |
No | Description of the checked-in version. | |
major |
No | If true (default), a new Major version will be created, otherwise a new Minor version will be created. | |
addACEs |
No | Grants additional access control entries (ACEs) when creating the object. | Access Control |
removeACEs |
No | Removes specified ACEs from the newly created object. | Access Control |
content |
No | The binary content of the document being created. Requires multipart/form-data content type. |
|
properties |
No | A JSON object containing the properties that should be applied to the new object. Must contain:
|
Properties |
succinct |
No | If set to true , the response will be more compact. |
Succinct |
Example Request:
curl -X 'POST' \
'{REPOSITORY_URL}/Animals/Dogs/Rex_pwc' \
-H 'Content-Type: application/json' \
-d '{
"operation": "checkIn",
"succinct": "true",
"major": false,
"checkinComment": "A new minor version",
"properties": {
"cmis:description": "Best Dog!"
}
}'
Response Format
- Content-Type:
application/json
- Response body: the JSON representation of the new version:
Field Name | Condition | Description | Link |
---|---|---|---|
properties |
succinct=false or succinct omitted |
The object's properties in detailed format. | Properties |
succinctProperties |
succinct=true |
The object's properties in concise format. | Succinct Properties |
Example Response - the new version (omitted some properties for clarity):
{
"succinctProperties": {
"cmis:name": "Rex",
"cmis:objectId": "2f14b215-32ce-497d-bbea-e8e58c1971bc",
"cmis:objectTypeId": "dog",
"cmis:description": "Best Dog!",
"cmis:isPrivateWorkingCopy": false,
"cmis:versionLabel": "1.1"
}
}
Cancel Check Out
The cancelCheckOut
operation discards a Private Working Copy, reverting any changes made during the check-out.
- Operation:
cancelCheckOut
- HTTP method:
POST
- Content-Type:
application/json
,multipart/form-data
- Target object: The Private Working Copy to be discarded. See Specifying the Target Object.
Parameters
There are no additional parameters available for the cancelCheckOut
operation.
Example Request:
curl -X 'POST' \
'{REPOSITORY_URL}/Animals/Dogs/Rex_pwc' \
-H 'Content-Type: application/json' \
-d '{
"operation": "cancelCheckOut"
}'
Get Versions
The getAllVersions
operation retrieves all versions of a document.
- Operation:
versions
- HTTP method:
GET
- Target object: The document whose versions are being requested. See Specifying the Target Object.
Parameters
Name | Required | Description | Link |
---|---|---|---|
succinct |
No | If set to true , the response will be more compact. |
Succinct |
filter |
No | Comma-separated list of properties to include in the response. | Filter |
Example Request:
curl -X 'GET' \
'{REPOSITORY_URL}/Animals/Dogs/Rex/versions'
Response Format
- Content-Type:
application/json
- Response body: a list of document versions in JSON format:
Field Name | Condition | Description | Link |
---|---|---|---|
properties |
succinct=false or succinct omitted |
The object's properties in detailed format. | Properties |
succinctProperties |
succinct=true |
The object's properties in concise format. | Succinct Properties |
Example Response - list of versions (omitted some properties for clarity):
[
{
"succinctProperties": {
"cmis:name": "Rex",
"cmis:objectId": "2f14b215-32ce-497d-bbea-e8e58c1971bc",
"cmis:versionLabel": "1.0",
"cmis:isLatestMajorVersion": true
}
},
{
"succinctProperties": {
"cmis:name": "Rex",
"cmis:objectId": "4d21a256-47de-432c-bf8c-a3e7b7e5a432",
"cmis:versionLabel": "1.1",
"cmis:isLatestVersion": true
}
}
]