Deleting Objects
The deleteObject
and deleteTree
operations in Contendo Server allow for the removal of objects from the repository.
The deleteObject
operation permanently removes an individual object, while the deleteTree
operation is used for
permanently
deleting a folder and all of its contents, including subfolders and documents.
Operations for deleting objects
Title | Description |
---|---|
Delete Object | Permanently deletes an individual object from the repository. This operation supports optional deletion of all versions. |
Delete Tree | Permanently deletes a folder and all of its contents, including subfolders and documents. This operation recursively deletes all objects in the folder. |
Delete Object
WARNING: deleteObject operation is non-reversable!
The deleteObject
operation in Contendo Server allows removing an object from the repository. This operation
permanently deletes the specified object unless versioning constraints apply.
Request Format
- Operation:
delete
- HTTP method:
POST
- Content-Type:
application/json
,multipart/form-data
- Target object: The object to be deleted. See Specifying the Target Object.
Parameters
Name | Required | Description |
---|---|---|
allVersions |
No | If true , deletes all versions of a versioned document. Defaults to false (deletes only latest version). |
Example Request - Deleting an object named Rex
:
curl -X 'POST' \
'{REPOSITORY_URL}/Animals/Dogs/Rex?operation=delete' \
-H 'Content-Type: application/json' \
-d '{
"allVersions"=true
}'
Response Format
On success, the server returns HTTP status 200 OK
. There is no response body.
Errors
In case of errors, the response body is a JSON with the message
field. Notable errors include:
HTTP Status | Message | Description |
---|---|---|
404 | Object not found | The specified object does not exist in the repository. |
405 | Can't delete root folder | The object is the root folder and it can't be deleted. |
409 | Folder is not empty | The object is a non-empty folder and can't be deleted. |
Delete Tree
WARNING: deleteTree operation is non-reversable!
The deleteTree
operation in Contendo Server allows for permanent deletion a folder and all its contents, including
subfolders and
documents. This operation performs a recursive deletion of all objects within the specified folder. If only an empty
folder should be deleted, Delete Object is preferred.
Request Format
- HTTP method:
POST
- Content-Type:
multipart/form-data
- Target object: The folder to be deleted. See Specifying the Target Object.
Parameters
Name | Required | Description |
---|---|---|
operation |
Yes | Always deleteTree . |
continueOnFailure |
No | If true , the operation continues deleting other objects even if some fail. Defaults to false . |
Example Request - Deleting a folder named DogRecords
and its contents:
curl -X 'POST' \
'{REPOSITORY_URL}/Animals/Dogs/DogRecords?operation=deleteTree' \
-H 'Content-Type: application/json' \
-d '{
"continueOnFailure"=true
}'
Response Format
- Content-Type:
application/json
- Response body: On complete success, there is no response body.
If the delete operation failed partially andcontinueOnFailure=true
, the response includes:
Field Name | Condition | Description |
---|---|---|
ids |
Deletion failed for at least one object and continueOnFailure=true |
List of IDs for which the delete operation failed |
Example - Response for partial failure:
{
"ids": [
"daadd3b4-8bea-4eea-b15d-80a9c22221e9",
"2c8eee45-a9e3-4161-b683-91c5f5fb996e"
]
}
Errors
HTTP Status | Message | Description |
---|---|---|
400 | deleteTree can only be invoked on a folder, but id {id} does not refer to a folder | The target object isn't a folder. Only folders can be deleted with deleteTree. |
404 | Object not found | The specified object does not exist in the repository. |
405 | Can't delete root folder | The object is the root folder and it can't be deleted. |