Configuring the updater file for generated endpoints

Within the context of Cloud API, an updater file defines how information is mapped from an element resource to the corresponding data model entity. This information is used for POSTs and PATCHes.


The updater file

The following sections provide an overview of configuring updater files for generated endpoints. For a complete description of how to configure mapping files, see Endpoint architecture.

Overview of updater file syntax

An updater file contains an updaters section that lists one or more API resources. For each resource, the following attributes are specified:

  • The schemaDefinition that defines the structure of the resource
    • This references a schema declared in a schema.json file.
  • The data model entity that serves as the root for mapping information for this resource.
  • A list of properties
    • Each property includes a path attribute. This defines, for each resource property, the data model entity property into which the resource field property is to be written.
    • Depending on the nature of the property, there may be additional attributes.

For example, the following is a portion of the updater for the base configuration Activity resource:

"Activity": {
  "schemaDefinition": "Activity",
  "root": "entity.Activity",
  "properties": {
    "description": {
      "path": "Activity.Description"
    },
    "mandatory": {
      "path": "Activity.Mandatory"
    },
    ...

Note the following:

  • This resource is defined in the schema who name is Activity (This schema is defined in some other schema.json file.)
  • The root for the resource mapping is entity.Activity.
  • For each instance of the resource:
    • The value of the description property is written to the Activity entity's Description field.
    • The value of the mandatory property is written to the Activity entity's Mandatory field.

Note that there may be properties that appear in the mapping file but not the updater file. This typically occurs with properties that are read-only. For example, the Activity entity has a closeDate property, which the application sets when the activity is closed. This property appears in the mapping file, as it can be read. But it does not appear it the updater file because it cannot be written to.

Modifications made to the updater file

The base configuration includes a set of API-specific extension updater files. The purpose of these files is to define updater information for custom resources for a given API. These files are named using the pattern <API>_ext-1.0.updater.json, where <API> is the internal name of the API. For example, the common_ext-1.0.updater.json file is used to define updater information for custom resources in the Common API. You can access extension mapping files in Studio through the integration -> mappers -> ext -> <API>.v1 node.

(There is an exception to the previous statement. When you add endpoints to the Job API, updater modifications are not made to a job_ext-1.0.updater.json file, but rather to the policyperiod_ext-1.0.updater.json file.)

Resource-level information

The REST endpoint generator adds the following resource-level information to the updater file:

    "<resourceName>": {
      "schemaDefinition": "<schemaNameForResource>",
      "root": "entity.<customEntity>",
      // TODO RestEndpointGenerator : Add updater properties here
      ...
    }

Updaters added by the REST endpoint generator

The REST endpoint generator also adds updaters for any of the fields in the data model entity whose setterScriptability is set to all. It does not create an updater for the id field that it added to the schema. This is because id values cannot be updated.

For example, suppose you generated endpoints for a CustomEntity_Ext entity with the following fields:

  • Description (a varchar field)
  • IsActive (a Boolean field)
  • ActiveDate (a datetime field)
  • ActiveCount (an integer field)

The REST endpoint generator adds the following to the updater file:

      "properties": {
        "activeCount": {
          "path": "CustomEntity_Ext.ActiveCount"
        },
        "activeDate": {
          "path": "CustomEntity_Ext.ActiveDate"
        },
        "description": {
          "path": "CustomEntity_Ext.Description"
        },
        "isActive": {
          "path": "CustomEntity_Ext.IsActive"
        },
        ...
      }

Additional configuration work to do

You are responsible for the following configuration work:

  • Removing any updaters that were created by the REST endpoint generator but which correspond to fields that are not to be writeable from Cloud API
  • Adding updaters for any fields that must be writeable to Cloud API but that do not have updaters

For more information on how to configure scalar and compound datatype properties in an updater file, see Adding scalars and Adding compound datatypes.