Creating Objects

The createObject operation in Contendo Server allows creating a new object of a specified type within the repository. This operation is flexible and supports creating various types of objects, including documents, folders, items and relationships.

Request Format

  • Operation: createObject
  • HTTP method: POST
  • Content-Type: application/json, multipart/form-data (mandatory if content is set)
  • Target object: The folder where the new object will be created. See Specifying the Target Object.

Parameters

Name Required Description Link
properties Yes A JSON object containing the properties that should be applied to the new object.
Must contain:
  • cmis:name: The name of the new object.
  • cmis:objectTypeId: The type of object being created (e.g., document, folder, item, custom type).
May contain additional custom properties defined on the specified object type.
Properties
succinct No If set to true, the response will be more compact. Succinct
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 (Documents only) The binary content of the document being created. Requires multipart/form-data content type.
versioningState No (Documents only) Determines how versioning is handled.
Possible values:
  • major: Version set to 1.0. Default.
  • minor: Version set to 0.1
Versioning

The type of the created object is defined by the cmis:objectTypeId property. For more details about object types see Types in Contendo Server

Example - Creating a Document:

curl -X 'POST' \
  '{REPOSITORY_URL}/Animals/Dogs?operation=createObject' \
  -H 'Content-Type: multipart/form-data' \
  -F 'properties={"name":"Rex","objectTypeId":"document"}' \
  -F 'content=@Rex.png' \
  -F 'versioningState=major'

Example - Creating a Folder:

curl -X 'POST' \
  '{REPOSITORY_URL}/Animals' \
  -H 'Content-Type: application/json' \
  -F 'operation=createObject' \
  -d '{ 
  properties={
    "name":"Cats",
    "objectTypeId":"folder"
  } 
}'

Example - Creating an Item:

curl -X 'POST' \
  '{REPOSITORY_URL}/Petstores/Addressess?operation=createObject' \
  -H 'Content-Type: application/json' \
  -d '{
  properties={
    "name":"Great Petshop", 
    "city": "Amsterdam", 
    "country": "Netherlands", 
    "objectTypeId":"item"
  }
}'

Response Format

  • Content-Type: application/json
  • Response body: the JSON representation of the retrieved 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:

{
  "succinctProperties": {
    "name": "Rex",
    "description": "Dog"
  }
}