Request
To specify the data type and/or a localised list of allowed values for an existing custom field, send a PUT request to:
https://<host>:<port>/businessConfig/admin/v1/fields/{fieldId}
Headers
-
Content-Type: application/json
Mandatory arguments
If you do not supply a value for a parameter that already has a value, it will be set to null.
The recommended approach is to use a GET /field/{fieldId} request to get the field, change the value of the dataType and/or options parameters, then use this modified set of parameters in the body of the PUT request.
-
fieldId– the ID of the field (in URL) -
id– the ID of the field (in body) -
name– the name of the field (in body) -
dataType– the field's data type. This determines the control that OpCon uses when you edit the custom field. It must be one of:StringIntegerBooleanDateObject -
entityType– the type of entity that the field belongs to. One of:EditorialContentTechnicalContentEditorialChannelTechnicalChannelEventNode NodeLinkContentGroupProductProductLinkAccountBillingAddressDevice -
value– the default value for the field -
displayOrder– determines where the field is displayed in the display order -
options– a localised list of values for the field. OpCon uses this list to present a drop-down list of values.This is not actually mandatory, but it is required for this use case.
This consists of:
-
key– the name of the key for which values are being defined -
value– the value forkey. This is an array of one or more key-value pairs of the followinf format:
"<locale>": "<value of key for locale>"
The value must be of the type specified indataType.If you do not need to localise, use
"none"as the locale.
-
Other arguments
-
scope– for a custom field, this is alwayscustom. -
displayName– the field's display name. If not specified,nameis used. -
isLocalised– whether the field is localised or not -
creationDate– field creation date (set automatically if you do not provide a value) -
lastModificationDate– field last modified date (set automatically if you do not provide a value)
Example – localised
A PUT request with this payload modifies the specified custom field to specify the type and add/modify a localised list of values for the editorial content entity:
{
"name": "title",
"dataType": "String",
"scope": "custom",
"isLocalised": true,
"entityType": "EditorialContent",
"options": [
{
"key": "ComingSoon",
"value": {
"fr": "A Venir",
"en": "Coming Soon"
}
},
{
"key": "NewRelease",
"value": {
"fr": "Nouvelle Sortie",
"en": "New Release"
}
}
]
}
Example – non-localised
A PUT request with this payload modifies the specified custom field to specify the type and add/modify a non-localised list of values for the editorial content entity:
{
"name": "title",
"dataType": "String",
"scope": "custom",
"isLocalised": true,
"entityType": "EditorialContent",
"options": [
{
"key": "ComingSoon",
"value": {
"none": "Coming Soon"
}
},
{
"key": "NewRelease",
"value": {
"none": "New Release"
}
}
]
}
Response
A successful request returns an HTTP 201 status. The request returns the ID of the field.
A bad request returns an HTTP 400 status.
See also
For full details of this API, see config-manager API documentation.