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.
| Type | Chapter | Localizable |
|---|---|---|
string | String | yes |
html | HTML content | yes |
number | Number | yes |
boolean | Boolean | yes |
email | yes | |
object | Substructure | yes |
array | Array (list) | yes |
file | Media file | yes |
geo-point | GEO coordinate | no |
compound | Macro | yes |
Common parameters
| Parameter | Meaning |
|---|---|
type | data type, required |
optional | true: The field may be missing. Default false, so the field is required. |
localizable | true: The value is kept separately per language, see Multilingual content. |
cms | Metadata 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" }]
}