Skip to content

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
  • URL: {REPOSITORY_URL}
  • Content-Type: application/json, multipart/form-data (mandatory if content is set), application/x-www-form-urlencoded
  • Target Object: The folder where the new object will be created.

Parameters

Name Required Description Link
properties Yes A JSON object containing the properties that should be applied to the new object.
Must contain:
  • name: The name of the new object.
  • 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 (default), the response will be more compact. If set to false it will be more detailed. 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 objectTypeId property. For more details about object types see Types in Contendo Server

Example - Creating a Document:

curl -X 'POST' \
  '{REPOSITORY_URL}/Animals/Dogs' \
  -H 'Content-Type: multipart/form-data' \
  -F 'operation: createObject'
  -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' \
  -d '{ 
  "operation": "createObject",
  "properties": {
    "name":"Cats",
    "objectTypeId":"folder"
  } 
}'

Example - Creating an Item:

curl -X 'POST' \
  '{REPOSITORY_URL}/Petstores/Addressess' \
  -H 'Content-Type: application/json' \
  -d '{
  "operation": "createObject",
  "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 / succinctProperties Always present The properties of the object. Properties

Example response:

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