Skip to main content

Available data types

The description of the fields is based on fastest-validator. However, only a selection of its types and parameters is supported, plus a few CMS-specific types. Only type must always be specified. Unknown parameters are rejected.

As an example, an API tutorial/people is built up step by step. Each example uses all supported settings, whether sensible in the individual case or not. In the chapters, { "…": "as before" } stands for the fields already described. The complete description for copying is given below.

TypeChapterLocalizable
stringStringyes
htmlHTML contentyes
numberNumberyes
booleanBooleanyes
emailEmailyes
objectSubstructureyes
arrayArray (list)yes
fileMedia fileyes
geo-pointGEO coordinateno
compoundMacroyes

Common parameters​

ParameterMeaning
typedata type, required
optionaltrue: The field may be missing. Default false, so the field is required.
localizabletrue: The value is kept separately per language, see Multilingual content.
cmsMetadata for the database and the editing application

For localizable fields, the interface always transfers an object with one entry per language instead of the simple value, e.g. { "de": "…", "en": "…" }.

Complete example​

The API tutorial/people with all fields from the chapters String through Array:

{
"application": "Tutorial",
"label": "People",
"project": "inSynergie CMS",
"fields": {
"name": {
"cms": { "column": true },
"empty": false,
"max": 40,
"min": 4,
"type": "string"
},
"age": {
"cms": { "column": true },
"integer": true,
"max": 120,
"min": 0,
"optional": true,
"type": "number"
},
"married": {
"cms": { "column": true },
"optional": true,
"type": "boolean"
},
"email": {
"cms": { "column": true },
"type": "email"
},
"address": {
"cms": { "column": true },
"optional": true,
"properties": {
"city": { "cms": { "column": true }, "optional": true, "type": "string" },
"street": { "optional": true, "type": "string" },
"postalcode": { "optional": true, "type": "string" }
},
"strict": true,
"type": "object"
},
"colleagues": {
"optional": true,
"items": {
"properties": {
"first": { "optional": true, "type": "string" },
"last": { "type": "string" }
},
"strict": true,
"type": "object"
},
"min": 0,
"max": 5,
"type": "array"
}
}
}
curl -X POST -u 'CMS_User_01:<password>' -H 'Content-Type: application/json' \
-d @people.json https://cms.example.org/schema/tutorial/people

A matching record:

{
"name": "Nicolas",
"age": 42,
"married": false,
"email": "nicolas@example.org",
"address": { "city": "Bonn" },
"colleagues": [{ "first": "Ada", "last": "Lovelace" }]
}