Objects definitions

Locale

  • key - Two-letter code of a language.

  • default - Defines if a locale is a default locale for a project.

  • active - Defines if a locale is active in a project.

{
"key" : "en",
"default" : true,
"active" : true
}

Field

Field object has two possible forms, depending on if the field is a collection or not.

Non-collection field

  • key (string) - Field key specified in the spec file. Required.

  • values (object) - An object which maps two-letter codes of locales to values for these locales. Required, but can be empty object.

For localisable field, values object with locale-value mapping:

{
"key" : "caption",
"values": {
"en": "Another Text",
"de": "Ein anderer Text"
}
}

For non-localisable field, unless it's empty, values object has all key as locale code:

{
"key" : "caption",
"values": {
"all": "Caption Text"
}
}

If default value for a field is specified in the spec, it will be applied as a value for default locale (or for all) when resource is created. Defaults are not applied on resource update. It is possible to overwrite default value. In order to discard default value, null can be passed as a value.

The values of the field can be updated by sending request with new values. null value can be sent to clear value for the locale.

It is not possible to update value only for a specific locale of the field, all locales are updated at once with provided values object. If the field is present in the request and the value for some locale is omitted, that locale value will be cleared.

Collection field

  • key (string) - Field key specified in the spec file. Required.

  • items (array) - Items of a collection field. Required, but can be empty array.

Each collection item is an array of the fields. Refer to the section above describing non-collection field format.

A field of any type can be used inside collection, including collection field itself. But only two-level nesting is allowed - it means that collection field can have another (nested) collection inside its item, but no more.

Here is a complete example of a value for collection field countries. It has two items with country_name text field and largest_cities nested collection. For each country there are three items in cities collection, represented by text field city_name and number field population.

{
"key" : "countries",
"items": [
[
{
"key" : "country_name",
"values": {
"en": "United Kingdom"
}
},
{
"key" : "largest_cities",
"items": [
[
{
"key" : "city_name",
"values": {
"en": "London"
}
},
{
"key" : "population",
"values": {
"all": 7556900
}
}
],
[
{
"key" : "city_name",
"values": {
"en": "Birmingham"
}
},
{
"key" : "population",
"values": {
"all": 984333
}
}
],
[
{
"key" : "city_name",
"values": {
"en": "Liverpool"
}
},
{
"key" : "population",
"values": {
"all": 864122
}
}
]
]
}
],
[
{
"key" : "country_name",
"values": {
"en": "Belarus"
}
},
{
"key" : "largest_cities",
"items": [
[
{
"key" : "city_name",
"values": {
"en": "Minsk"
}
},
{
"key" : "population",
"values": {
"all": 1742124
}
}
],
[
{
"key" : "city_name",
"values": {
"en": "Gomel"
}
},
{
"key" : "population",
"values": {
"all": 369200
}
}
],
[
{
"key" : "city_name",
"values": {
"en": "Mogilev"
}
},
{
"key" : "population",
"values": {
"all": 342700
}
}
]
]
}
]
]
}