Skip to main content
Skip table of contents

Specifying default values

Overview

You can specify a default value for either custom or built-in fields for the following entities:

  • EditorialContent
  • TechnicalContent
  • EditorialChannel
  • TechnicalChannel
  • Event
  • Node

If a value is not supplied for a field in the data that is ingested, the specified default value is used.

These values are also used in OpCon when a value has not been explicitly defined for a field.

You can specify a default value for:

Adding a custom field with a default value

When you add a custom field, it is located in the relevant entity's metaDataSet > metadata block.

Request

To add a custom field (which may or may not include a default value), send a POST request to:

https://<host>:<port>/businessConfig/admin/v1/fields

Mandatory arguments

  • name – the name of the field
  • dataType – the field's data type. 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
  • value – the default value for the field

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
  • lastModificationDate – field last modified date

Example

A POST request with this payload adds a custom field with a default value to the editorial content entity:

CODE
{
    "name": "title",
    "dataType": "String",
    "scope": "core",
    "isLocalised": true,
    "entityType": "EditorialContent",
    "value": "Cast Away"
}

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.

Specifying a default value for an existing field

Request

To add a default value for a field, send a PUT request to:

https://<host>:<port>/businessConfig/admin/v1/fields/{fieldId}

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 value parameter to the default value that you want to specify, 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. One of:
    • String
    • Integer
    • Boolean
    • Date
    • Object
  • entityType – the type of entity that the field belongs to. One of:
    • EditorialContent
    • TechnicalContent
    • EditorialChannel
    • TechnicalChannel
    • Event
    • Node
  • value – the default value for the field
  • displayOrder – determines where the field is displayed in the display order

Other arguments

  • scope – whether the field is built-in (core) or custom (custom)
  • displayName – the field's display name. If not specified, name is used.
  • isLocalised – whether the field is localised or not
  • creationDate – field creation date
  • lastModificationDate – field last modified date

Example

A PUT request with this payload adds a default value for the specified field:

CODE
{
    "fieldId": "1234",
    "id": "1234",
    "name": "title",
    "dataType": "String",
    "scope": "core",
    "isLocalised": true,
    "entityType": "EditorialContent",
    "value": "Cast Away"
}

Response

A successful request returns an HTTP 200 status. The request returns the ID of the field.

A bad request returns an HTTP 400 status.

If the specified field does not exist, the request returns an HTTP 404 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.