Configuring a custom field for OpCon at creation time
Request
To specify the data type and/or a localised list of allowed values when adding a custom field, send a POST request to:
https://<host>:<port>/businessConfig/admin/v1/fields
When you add a custom field, it is located in the relevant entity's metaDataSet > metadata
block.
Headers
Content-Type: application/json
Mandatory arguments
name
– the name of the fielddataType
– the field's data type. This determines the control that OpCon uses when you edit the custom field. It must be one of:String
Integer
Boolean
Date
Object
scope
– whether the field is built-in (core
) or custom (custom
)isLocalised
– whether the field is localised or notentityType
– the type of entity that the field belongs to. One of:EditorialContent
TechnicalContent
EditorialChannel
TechnicalChannel
Event
Node
NodeLink
ContentGroup
Product
ProductLink
AccountBillingAddress
Device
value
– the default value for the fieldoptions
– 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 definedvalue
– the value forkey
. This is an array of one or more key-value pairs of the following 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
id
– the ID of the fielddisplayName
– the field's display name. If not specified,name
is used.displayOrder
– determines where the field is displayed in the display ordercreationDate
– 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 POST request with this payload adds a custom field with a specified type and a localised list of values to 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 POST request with this payload adds a custom field with a specified type and a non-localised list of values to 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 Business Configuration Manager (BCM) API documentation: core.