Skip to main content
Skip table of contents

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 field
  • dataType – 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 not
  • entityType – 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 field
  • 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 for key. 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 in dataType.

      If you do not need to localise, use "none" as the locale.

Other arguments

  • id – the ID of the field
  • displayName – the field's display name. If not specified, name is used.
  • displayOrder – determines where the field is displayed in the display order
  • 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 POST request with this payload adds a custom field with a specified type and a localised list of values to the editorial content entity:

CODE
{
    "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:

CODE
{
    "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.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.