Update Object
In Contendo Server, objects can be updated in various ways depending on the required modification. Properties (metadata) and content are updated independently.
Operations for updating objects
Operation | Description |
---|---|
Update Properties | Modifies the metadata (properties) of an object without changing its content. |
Set Content | Replaces the content of a document while keeping its properties unchanged. |
Append Content | Appends new data to an existing document without removing existing content. |
Delete Content | Removes the content of a document while preserving its metadata. |
Update Properties
The updateProperties
operation in Contendo Server allows updating the properties of an existing object in the
repository. This operation supports modifying metadata fields but does not affect the object's content.
Note: Only readwrite properties may be updated.
Request Format
- Operation:
updateProperties
- HTTP method:
POST
- Content-Type:
application/json
,multipart/form-data
- Target object: The object whose properties will be updated. See Specifying the Target Object.
Parameters
Name | Required | Description | Link |
---|---|---|---|
properties |
Yes | A JSON object containing the properties to be updated. Only the specified properties will be modified. Fields that are not included remain unchanged. | Properties |
succinct |
No | If set to true , the response will be more compact. |
Succinct |
Example Request - Updating description
and weight
properties:
curl -X 'POST' \
'{REPOSITORY_URL}/Animals/Dogs/Rex'/ \
-H 'Content-Type: application/json' \
-d '{
"operation": "createObject",
"succinct": true,
"properties": {
"cmis:description":"Good Dog!",
"weight":35
}
}'
Response Format
- Content-Type:
application/json
- Response body: the JSON representation of the updated object:
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 - Properties description
and weight
are updated to new values, while other properties are
unchanged (omitted some properties for clarity):
{
"succinctProperties": {
"cmis:name": "Rex",
"cmis:objectId": "2f14b215-32ce-497d-bbea-e8e58c1971bc",
"cmis:objectTypeId": "dog",
"cmis:description": "Good Dog!",
"weight": 35,
"height": 63
}
}
Set Content
The setContent
operation in Contendo Server allows updating the content of an existing document while preserving its
metadata. This operation replaces the document's binary content but does not modify its properties.
Request Format
- Operation:
setContent
- HTTP method:
POST
- Content-Type:
multipart/form-data
- Target object: The document whose content will be updated. See Specifying the Target Object.
Parameters
Name | Required | Description | Link |
---|---|---|---|
content |
Yes | The binary content to replace the current content of the document. | |
overwriteFlag |
No | If set to false , the operation fails if the document already has content. Defaults to true . |
|
succinct |
No | If set to true , the response will be more compact. |
Succinct |
Example Request - Updating the content of a document:
curl -X 'POST' \
'{REPOSITORY_URL}/Animals/Dogs/Rex' \
-H 'Content-Type: multipart/form-data' \
-F 'operation=setContent' \
-F 'succinct=true' \
-F 'content=@new_picture_of_rex.png;type=image/png'
Response Format
- Content-Type:
application/json
- Response body: the JSON representation of the updated document:
Field Name | Condition | Description | Link |
---|---|---|---|
properties |
succinct=false or succinct omitted |
The document's properties in detailed format. | Properties |
succinctProperties |
succinct=true |
The document's properties in concise format. | Succinct Properties |
Example Response - The content of the document has been updated. While most metadata remains unchanged, content stream-related properties,
such as cmis:contentStreamFileName
, cmis:contentStreamLength
, and cmis:contentStreamMimeType
, are modified to
reflect the new content (some properties are omitted for clarity):
{
"succinctProperties": {
"cmis:name": "Rex",
"cmis:objectId": "2f14b215-32ce-497d-bbea-e8e58c1971bc",
"cmis:objectTypeId": "dog",
"cmis:contentStreamFileName": "new_picture_of_rex.png",
"cmis:contentStreamLength": 1048576,
"cmis:contentStreamMimeType": "image/png"
}
}
Append Content
The appendContent
operation in Contendo Server allows appending new data to the existing content of a document while
preserving its metadata. If the document has no existing content, it will be set instead. Unlike setContent
, which
fully replaces the content, appendContent
extends the current content by adding new data at the end.
When to Use appendContent
Use appendContent
when you need to incrementally add data to a document without overwriting its existing content. This
is useful for scenarios such as:
- Logging data to a text file.
- Incrementally updating large binary files.
- Streaming additional content without re-uploading the entire document.
Request Format
- Operation:
appendContent
- HTTP method:
POST
- Content-Type:
multipart/form-data
- Target object: The document to which content will be appended. See Specifying the Target Object.
Parameters
Name | Required | Description | Link |
---|---|---|---|
content |
Yes | The binary content to append to the document's existing content. | |
succinct |
No | If set to true , the response will be more compact. |
Succinct |
Example Request - Appending new content to an existing document:
curl -X 'POST' \
'{REPOSITORY_URL}/Animals/Dogs/RexLog' \
-H 'Content-Type: multipart/form-data' \
-F 'operation=appendContent' \
-F 'succinct=true' \
-F 'content=@additional_data.txt;type=text/plain'
Response Format
- Content-Type:
application/json
- Response body: The JSON representation of the updated document.
Field Name | Condition | Description | Link |
---|---|---|---|
properties |
succinct=false or succinct omitted |
The document's properties in detailed format. | Properties |
succinctProperties |
succinct=true |
The document's properties in concise format. | Succinct Properties |
Example Response - The content of the document has been appended. While most metadata remains unchanged, content stream-related properties,
such as cmis:contentStreamLength
, are updated to reflect the new content size (some properties are omitted for
clarity):
{
"succinctProperties": {
"cmis:name": "RexLog",
"cmis:objectId": "2f14b215-32ce-497d-bbea-e8e58c1971bc",
"cmis:objectTypeId": "dogLog",
"cmis:contentStreamFileName": "log.txt",
"cmis:contentStreamLength": 2097152,
"cmis:contentStreamMimeType": "text/plain"
}
}
Delete Content
The deleteContent
operation in Contendo Server allows removing the content stream of an existing document while
preserving its metadata. This operation deletes the document's binary content but does not modify its properties.
Request Format
- Operation:
deleteContent
- HTTP method:
POST
- Content-Type:
application/json
,multipart/form-data
- Target object: The document whose content will be deleted. 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 - Deleting the content of a document:
curl -X 'POST' \
'{REPOSITORY_URL}/Animals/Dogs/Rex' \
-H 'Content-Type: application/json' \
-d '{
"operation": "deleteContent",
"succinct": true
}'
Response Format
- Content-Type:
application/json
- Response body: the JSON representation of the updated document (with content removed):
Field Name | Condition | Description | Link |
---|---|---|---|
properties |
succinct=false or succinct omitted |
The document's properties in detailed format. | Properties |
succinctProperties |
succinct=true |
The document's properties in concise format. | Succinct Properties |
Example Response - The content of the document has been deleted. Metadata remains unchanged (some properties omitted for clarity):
{
"succinctProperties": {
"cmis:name": "Rex",
"cmis:objectId": "2f14b215-32ce-497d-bbea-e8e58c1971bc",
"cmis:objectTypeId": "dog",
"cmis:contentStreamFileName": null,
"cmis:contentStreamLength": null,
"cmis:contentStreamMimeType": null
}
}