Type Management

Types ara managed via a set of endpoints in a CRUD fashion:

Operation Description
Create Type Creating a new type by inheriting from an existing one.
Get Type Retrieve a specific type.
Get Type Children Retrieve children of a type or retrieve all base types.
Get Type Descendants Retrieve descendant of a type or retrieve all types.
Update Type Updating an existing type.
Delete Type Deleting a specific type.

Type Management Rules

General rules when creating and updating types:

  • Every custom type extends the type defined by its parentId type attribute.
  • Type attributes are specific to each type and as such aren't inherited.
  • Property definitions, on the other hand, are inherited. All property definitions present on a type will be passed to all descendant types.
  • Inherited property definitions can't be overwritten on the extending type, but have to be updated on the owning type instead.

Additionally, creating and updating have their own specific rules.

Type Management Operations

Create Type

The createType operation in Contendo Server allows defining a new custom object type in the repository. This operation enables extending the repository's type system by introducing new object types with specific property definitions and behaviors.

Rules:

  • general rules
  • only added property definitions need to be defined. Inherited ones are automatically added.
  • new base types can't be created - new types must have a parent.

Request Format

  • Operation: createType
  • HTTP method: POST
  • Content-Type: application/json, multipart/form-data
Parameters
Name Required Description Link
type Yes The JSON Object representing the Type Definition of the new type to be created. Type Definition

Example Request - Creating a custom type Dog that inherits from the custom document type Animal:

curl -X 'POST' \
  '{REPOSITORY_URL}' \
  -H 'Content-Type: application/json' \
  -d '{
    "operation": "createType",
    "type": {
      "id": "dog",
      "localName": "dog",
      "displayName": "Dog",
      "description": "A document for dogs.",
      "baseId": "cmis:document",
      "parentId": "animal",
      "show": true,
      "propertyDefinitions": {
        "color": {
          "id": "color",
          "localName": "color",
          "displayName": "Color",
          "description": "Dog color",
          "propertyType": "string",
          "choices": [
            "White",
            "Brown",
            "Black",
            "Unknown"
          ],
          "openChoice": false,
          "defaultValue": "Unknown",
          "order": 10
        },
        "height": {
          "id": "height",
          "localName": "height",
          "displayName": "Height",
          "description": "Dog height",
          "propertyType": "integer",
          "required": true,
          "order": 20
        }
      }
    }
  }'

Response Format

  • Content-Type: application/json
  • Response body: JSON representation of the newly created type.
Field Name Condition Description Link
type Always The JSON Object representing the Type Definition of the newly created type. Full format that includes all attributes and properties, including inherited ones. Type Definition

Get Type Definition

The typeDefinition operation in Contendo Server allows retrieving the full Type Definition for a single type. This operation provides detailed information about a type's attributes and property definitions, including inherited ones.

Request Format

  • Operation: typeDefinition
  • HTTP method: GET
Parameters
Name Required Description
typeId Yes The identifier of the type to retrieve.

Example Request - Retrieving the type definition for dog:

curl -X 'GET' \
 '{REPOSITORY_URL}?typeId=dog' 

Response Format

  • Content-Type: application/json
  • Response body: JSON representation of the type definition.
Field Name Condition Description Link
type Always The JSON Object representing the Type Definition of the target type. Full format that includes all attributes and properties, including inherited ones. Type Definition

Get Type Children

The typeChildren operation in Contendo Server retrieves the direct child types of a specified type. Alternatively it can also be used to retrieve all base types.

Request Format

  • Operation: typeChildren
  • HTTP method: GET
Parameters
Name Required Description
typeId No The identifier of the parent type whose children should be retrieved. If not set, all base types are returned.
includePropertyDefinitions No If true, includes property definitions in the response. Default is false.
maxItems No The maximum number of child types to return.
skipCount No The number of child types to skip before starting to return results. Default is 0.

Example Request - Retrieving child types of animal, including property definitions, and limiting results to 2:

curl -X 'GET' \
  '{REPOSITORY_URL}?typeId=animal&includePropertyDefinitions=true&maxItems=2&skipCount=0'

Response Format

  • Content-Type: application/json
  • Response body: JSON representation of the retrieved child types.
Field Name Condition Description Link
types Always List of type JSON Objects representing the Type Definitions. Full format that includes all attributes and, if requested via includePropertyDefinitions, properties, including inherited ones. Type Definition
hasMoreItems Always Specifies if there are more items after the requested page.
numItems Usually* Total number of type children for the requested type. *May be omitted if total number is unknown - very high number of types.

Example Response - Type attributes and property definitions are omitted for clarity.

{
  "types": [
    {
      "id": "dog",
      ...
    },
    {
      "id": "cat",
      ...
    }
  ],
  "numItems": 2,
  "hasMoreItems": false
}

Get Type Descendants

The typeDescendants operation in Contendo Server retrieves all descendant types of a specified type. Alternatively it can also be used to retrieve all types.

Request Format

  • Operation: typeDescendants
  • HTTP method: GET
Parameters
Name Required Description
typeId No The identifier of the type whose descendants should be retrieved. If not set, all types are returned.
includePropertyDefinitions No If true, includes property definitions in the response. Default is false.
depth No The number of levels of depth in the type hierarchy from which to return results. If -1 (default), depth is considered infinite.

Example Request - Retrieving descendant types of animal, including property definitions, and limiting depth to 2:

curl -X 'GET' \
  '{REPOSITORY_URL}?typeId=animal&includePropertyDefinitions=true&depth=2'

Response Format

  • Content-Type: application/json
  • Response body: JSON representation of the retrieved descendant types via a tree-like structure. The response is an array of Type-Nodes:
Field Name Condition Description Link
type Always The JSON Object representing the Type Definition. Full format that includes all attributes and, if requested via includePropertyDefinitions, properties, including inherited ones. Type Definition
children If children exist Array of children type nodes of the type.

Example Response - Type attributes and property definitions are omitted for clarity:

[
  {
    "type": {
      "id": "dog",
      ...
    },
    "children": [
      {
        "type": {
          "id": "largeDog",
          ...
        },
        "children": [
          {
            "type": {
              "id": "germanShepherd",
              ...
            }
          },
          {
            "type": {
              "id": "greatDane",
              ...
            }
          }
        ]
      },
      {
        "type": {
          "id": "smallDog",
          ...
        },
        "children": [
          {
            "type": {
              "id": "chihuahua",
              ...
            }
          },
          {
            "type": {
              "id": "pomeranian",
              ...
            }
          }
        ]
      }
    ]
  },
  {
    "type": {
      "id": "cat",
      ...
    }
  }
]

Update Type

The updateType operation in Contendo Server allows modifying an existing custom type definition. This operation enables changing certain attributes and property definitions while maintaining the type's integrity.

Rules:

  • general rules
  • type attributes:
    • id serves as the identifier to determine which type should be updated.
    • queryName, baseId and parentId may not be changed.
    • omitting an attribute sets the value to null - even unchanging attributes should be set.
  • property definitions:
    • only updated or added property definitions need to be defined. Others will be left unchanged.
    • types with descendant types may be updated, but new properties already present on any descendant type may not be added.
    • property constraints can be broadened but not narrowed. E.g. for a string property definition with max length 25, the max length can be increased (e.g. set to 30), but not decreased (e.g. set to 20).
    • added property definitions with the attribute required set to true must also have the defaultValue attribute set.
    • the attribute required may not change form true to false. The opposite is allowed.
    • propertyType, cardinality and queryName may not change
    • the attribute openChoice may not change form true to false. The opposite is allowed.
    • choices attribute values may not be removed if openChoice is false, but may be added to.
  • base types can be updated in a very limited fashion:
    • custom type attributes may be added
    • custom property definition attributes may be added to existing property definitions.

Request Format

  • Operation: updateType
  • HTTP method: POST
  • Content-Type: application/json, multipart/form-data
Parameters
Name Required Description Link
type Yes The JSON Object representing the updated Type Definition. Type Definition

Example Request - Updating the Dog type to update the choices of the color property and add a new property weight:

curl -X 'POST' \
  '{REPOSITORY_URL}' \
  -H 'Content-Type: application/json' \
  -d '{
    "operation": "updateType",
    "type": {
      "id": "dog",
      "localName": "dog",
      "displayName": "Dog",
      "description": "A document for dogs.",
      "baseId": "cmis:document",
      "parentId": "animal",
      "show": true,
      "propertyDefinitions": {
        "color": {
          "id": "color",
          "localName": "color",
          "displayName": "Color",
          "description": "Dog color",
          "propertyType": "string",
          "choices": [
            "White",
            "Brown",
            "Black",
            "Gray",
            "Unknown"
          ],
          "openChoice": false,
          "defaultValue": "Unknown",
          "order": 10
        },
        "weight": {
          "id": "weight",
          "localName": "weight",
          "displayName": "Weight",
          "description": "Dog weight",
          "propertyType": "integer",
          "required": true,
          "order": 30
        }
      }
    }
  }'

Response Format

  • Content-Type: application/json
  • Response body: JSON representation of the updated type.
Field Name Condition Description Link
type Always The JSON Object representing the updated Type Definition. Type Definition

Delete Type

The deleteType operation in Contendo Server allows for the removal of a custom object type from the repository. A type can only be deleted if it has no existing objects and no descendant types. Base types can't be deleted.

Request Format

  • Operation: deleteType
  • HTTP method: POST
  • Content-Type: application/json, multipart/form-data
Parameters
Name Required Description
typeId Yes The identifier of the type to be deleted.

Example Request - Deleting a type dog:

curl -X 'POST' \
  '{REPOSITORY_URL}' \
  -H 'Content-Type: application/json' \
  -d '{
    "operation": "deleteType",
    "typeId": "dog"
  }'

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 Type not found The specified type does not exist in the repository.