Skip to main content

Default Data

Default data defines fixture objects that are created when a tenant's data is initialized. Loading is idempotent: objects with a matching key value are skipped if they already exist.

Default data is loaded by calling POST /data/{tenantId}/loadDefaultData.

Definition

{
"class": "commons.country",
"key": "countryCode",
"objects": [
{ "name": "Netherlands", "countryCode": "NL" },
{ "name": "Germany", "countryCode": "DE" },
{ "name": "Belgium", "countryCode": "BE" }
]
}
PropertyTypeDescription
classTypeFQNThe type of objects to create.
keystringField name used for deduplication. If an existing object of this type already has this key value, that object is skipped.
objectsobject[]List of objects to create. Uses the same field format as the REST API create endpoint.

Deduplication

Before creating objects, the platform loads all existing objects of the given type and indexes them by the key field. Any incoming object whose key value already exists is skipped — existing objects are not updated.

This makes loadDefaultData safe to call multiple times without creating duplicates.

Object format

Each entry in objects uses the same field format as the data API's create endpoint. Relations can be expressed as TypeFQN references. Objects within the same data block can cross-reference each other — these references are resolved in memory before insertion.

Multiple blocks

A class file can contain multiple data entries, each for a different type:

"data": [
{
"class": "commons.country",
"key": "countryCode",
"objects": [
{ "name": "Netherlands", "countryCode": "NL" },
{ "name": "Germany", "countryCode": "DE" }
]
},
{
"class": "my-project.contractStatus",
"key": "code",
"objects": [
{ "name": "Active", "code": "active" },
{ "name": "Expired", "code": "expired" },
{ "name": "Draft", "code": "draft" }
]
}
]

Example

A NONE-typed class used purely to load reference data into a tenant:

{
"class": "my-project.referenceData",
"type": "NONE",

"data": [
{
"class": "commons.country",
"key": "countryCode",
"objects": [
{ "name": "Netherlands", "countryCode": "NL", "vatRate": "21" },
{ "name": "Germany", "countryCode": "DE", "vatRate": "19" },
{ "name": "Belgium", "countryCode": "BE", "vatRate": "21" }
]
}
]
}