Skip to main content

"createIntegrationTable" (JSON Action)

JSON hub "createIntegrationTable action creates a new integration table in FairCom Edge

The "createIntegrationTable" action creates an integration table.

  • The "createIntegrationTable" action creates an integration table.

    This means that it will have the automatically-added integration fields discussed in the Integration fields section, in addition to the fields you explicitly add yourself using the fields property.

  • If the table already exists, it returns or logs an error.

  • Integration tables are created with input and read privileges only. This enables them for audit trail purposes. Allowing updates and deletions would destroy audit integrity.

Request examples

Minimal

{
  "api":        "hub",
  "action":     "createIntegrationTable",
  "params":     {
    "tableName": "test1"
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}

This example creates a new integration table and a transform simultaneously

{
  "api": "hub",
  "action": "createIntegrationTable",
  "params": {
    "tableName": "transformExampleTable",
    "fields": [
      {
        "name":     "my_input_varchar",
        "type":     "VARCHAR",
        "length":   128,
        "nullable": true
      },
      {
        "name":     "my_output_field",
        "type":     "JSON"
      }
    ],
    "transformSteps": [
      {
        "transformStepMethod": "javascript",
        "codeName": "transformExample"
      },
      {
        "transformStepMethod": "tableFieldsToJson",
        "mapOfPropertiesToFields": [
          {
            "fieldName": "my_input_varchar",
            "recordPath": "my_output_field.myProperty"
          }
        ]
      }
    ]
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
{
  "api":        "hub",
  "apiVersion": "1.0",
  "requestId":  "2",
  "action":     "createIntegrationTable",
  "params":     {
    "databaseName": "faircom",
    "tableName":    "test2",
    "fields": [
      {
        "autoValue": "none",
        "name": "name",
        "type": "varchar",
        "length": 50,
        "primaryKey": null,
        "scale": null,
        "defaultValue": null,
        "nullable": false
      }
    ],
    "metadata":        { },
    "retentionPeriod": 4,
    "retentionUnit":   "week"
  },
  "apiVersion": "1.0",
  "debug": "max",
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
{
    "result": {},
    "requestId": "1",
    "errorCode": 0,
    "errorMessage": ""
}
{
    "result": {},
    "requestId": "2",
    "debugInfo": {
        "request": {
            "api": "hub",
            "action": "createIntegrationTable",
            "params": {
                "databaseName": "faircom",
                "tableName": "test1",
                "fields": [
                    {
                        "name": "t10",
                        "type": "VARCHAR",
                        "length": 128,
                        "nullable": true
                    }
                ],
                "metadata": {},
                "retentionPeriod": 4,
                "retentionUnit": "week"
            },
            "apiVersion": "1.0",
            "requestId": "2",
            "debug": "max",
            "authToken": "replaceWithAuthTokenFromCreateSession"
        }
    },
    "errorCode": 12020,
    "errorMessage": "Not able to create integration table [test1]. Integration table name already exists.",
    "authToken": "replaceWithAuthTokenFromCreateSession"
}

Use the createIntegrationTable JSON API action to create a new integration table in FairCom Edge

JSON hub APIAPI actionsJSON Actionintegration tables actionscreate integration tablecreateIntegrationTable

The "params" property is an object that contains an action's request parameters as defined by a set of properties. Each action defines its own required and optional properties. See System limits for a comprehensive overview of property requirements and limitations.

Table 1. createIntegrationTable "params" property summaries

Property

Description

Default

Type

Limits (inclusive)

databaseName

(optional) specifies the name of a database.

Defaults to the "defaultDatabaseName" value that is set during "createSession". If no default is set during "createSession", then "faircom" is used.

string

1 to 64 bytes

fields

(optional) contains objects that specify the settings of a field in a table.

[]

array

"autoValue"
"name"
"type"
"length"
"primaryKey"
"scale"
"defaultValue"
"nullable"
fields
.autoValue

(optional) controls when and how the server automatically sets the field value.

"none"

string

"changeid"
"incrementOnInsert"
"none"
"timestampOnInsert"
"timestampOnUpdate"
"timestampOnUpdateAndInsert
fields
.defaultValue

(optional) specifies the default value of a field.

""

string

0 to 65,500 bytes

fields
.length

(optional) specifies the length of a field's value in a record.

null

integer

1 to 65500

fields
.name

specifies a new name of the field.

Required - No default value

string

0 to 64 bytes

fields
.nullable

(optional) allows a field to contain a NULL value when true.

true

Boolean

true
false
fields
.primaryKey

(optional) adds a field to the specified ordinal position of the table's primary key when > 0.

null

integer

0 to 32

fields
.scale

(optional) specifies the number of places to the right of the decimal point.

null

integer

0 to 32

fields
.type

specifies the type of field.

Required - No default value

string

"bit"
"tinyint"
"smallint"
"integer"
"bigint"
"real"
"float"
"number"
"money"
"date"
"time"
"timestamp"
"char"
"varchar"
"lvarchar"
"binary"
"varbinary"
"lvarbinary"
"json"

metadata

(optional) exists primarily for the user interface to find integration information.

{}

object

May contain any number and type of user-defined properties

retentionPolicy

(optional) controls how messages are persisted.

"autopurge"

string

"autoPurge"
"neverPurge"

retentionPeriod

(optional) specifies the number of retention units, which controls how long data is retained – see "retentionUnit".

4

integer

1 to 100

retentionUnit

(optional) purges expired messages each time this unit cycles – see "retentionPeriod".

"week"

string

"minute"
"hour"
"day"
"week"
"month"
"year"
"forever"

tableName

specifies the name of a table.

Required - No default value

string

1 to 64 bytes

transformName

(deprecated) specifies the name of a transform process you have created. Replaced by the "transformSteps" property.

""

string

1 to 64 bytes

transformSteps

specifies an array of transform objects.

Required - No default value

array of objects

0 or more objects

transformSteps
.codeName

specifies the name of a code package that runs when a record is inserted into an integration table.

Required - No default value

string

1 to 64 bytes

transformSteps
.databaseName

(optional) specifies the database that contains an object, such as a table or code package.

""

string

1 to 64 bytes

transformSteps
.ownerName

(optional) specifies the account that owns an object, such as a table or code package.

""

string

1 to 64 bytes

transformSteps
.mapOfPropertiesToFields

(optional) specifies field in the table to be mapped to a field containing JSON properties.

[]

array

"binaryFormat"
"dateFormat"
"fieldName"
"numberFormat"
"recordPath"
"timeFormat"
"variantFormat"
transformSteps
mapOfPropertiesToFields
.binaryFormat

(optional) specifies how binary values are returned.

"base64"

string

"base64"
"byteArray"
"hex"
transformSteps
mapOfPropertiesToFields
.dateFormat

(optional) specifies the format of a date or a datetime embedded in a JSON string.

"iso8601"

string enum

"ccyy.mm.dd"
"mm.dd.ccyy"
"mm.dd.yy"
"dd.mm.ccyy"
"dd.mm.yy"
"ccyymmdd"
"yymmdd"
"iso8601"
"utc"
transformSteps
mapOfPropertiesToFields
.fieldName

specifies the name of a field in a table.

Required - No default value

string

1 to 64 bytes

transformSteps
mapOfPropertiesToFields
.numberFormat

(optional) specifies how numbers are formatted in the JSON response message.

"number"

string

"number"
"string"
transformSteps
mapOfPropertiesToFields
.recordPath

specifies the location in a record where the server reads or writes a JSON value.

Required - No default value

string

0 to 256 bytes

transformSteps
mapOfPropertiesToFields
.timeFormat

(optional) specifies how to interpret JSON strings and numbers as time fields.

"hh.mm.am/pm"

string

"hh.mm.am/pm"
"hh.mm.ss.am/pm"
"hh.mm.ss"
20:15:30
20.15&30
20H15M30S
"hh.mm"
"hhmm"
transformSteps
mapOfPropertiesToFields
.variantFormat

(optional) specifies how the server will represent the values of variant fields in its response to your request.

"json"

string

"binary"
"json"
"string"
"variantObject"
transformSteps
.targetDatabaseName

(optional) specifies the name of the database that contains the target table.

""

string

1 to 64 bytes

transformSteps
.targetOwnerName

(optional) specifies the name of the account that owns the target table.

""

string

1 to 64 bytes

transformSteps
.targetTableName

(optional) specifies the name of the target table.

""

string

1 to 64 bytes

transformSteps
.transformStepMethod

specifies the transform method the step will use.

Required - No default value

string enum

"javascript"
"jsonToDifferentTableFields"
"jsonToTableFields"
"tableFieldsToJson"
transformSteps
.transformStepName

(optional) specifies the name that will be assigned to each transform step.

""

string

1 to 64 bytes

transformSteps
.transformStepService

(optional) specifies the name of a transform service, which is the user-defined name for a library (.dll, .so, .dylib) that implements the transform step method.

""

string

1 to 64 bytes



The "databaseName" property is an optional string that specifies the database that contains the tables. It defaults to the database name supplied at login.

Note

In the API Explorer, "defaultDatabaseName" is set to "ctreeSQL" in the "createSession" action that happens at login.

  • A zero-length "databaseName" is invalid.

  • Its length limit is from 0 to 64 bytes.

  • If the "databaseName" property is omitted or set to null, the server will use the default database name specified at login.

  • If no default database is specified during "createSession", "databaseName" will be set to the "defaultDatabaseName" value that is specified in the services.json file.

"params": {
  "databaseName": "mainDatabase"
  }

The "fields" property is an array of objects. It is required when creating a table. Each object in the array defines a field by specifying its properties.

Example

"fields": [
  {
    "autoValue": "none",
    "name": "name",
    "type": "varchar",
    "length": 50,
    "scale": null,
    "defaultValue": null,
    "nullable": false
  }
]

This optional property indicates when and how the server automatically sets the field value.

Only one of these values is allowed per field.

  • "none" indicates that the server does not automatically set the field's value.

  • "incrementOnInsert" indicates that the server automatically increments a field’s value each time the server inserts a new record. It applies to fields that are of the type of decimal or one of the integer types, such as "bigint". Only one field per table can have this attribute. The server returns an error when assigning this attribute to multiple fields. The JSON DB API automatically creates the "id" field as an "incrementOnInsert" field. If you apply this attribute to another field, it becomes the only automatically incremented field in the table. If you want that field to be the primary key, assign  "primaryKey": 1 to it.

  • "timestampOnInsert" indicates that the server automatically sets a field’s value to the current date and time of an insert. It applies only to fields with a type of "timestamp".

    Note

    If you attempt to insert a record and specify a timestamp for a field that has "autoValue" set to "timestampOnInsert", the timestamp you specified is ignored, and the current date and time are assigned to the field.

  • "timestampOnUpdate" indicates that the server automatically sets a field’s value to the current date and time of an update. This setting applies only to timestamp fields.

  • "timestampOnUpdateAndInsert" indicates that the server automatically sets a field’s value to the current date and time of an insert and an update. It applies only to fields with a type of "timestamp".

  • "changeId" indicates the server uses the field for optimistic locking. The server automatically sets the field's value to the internal transaction number used during the last update of the record. This value changes each time the server updates the record. A table may only have one change tracking field. The field type must be "bigint".

    The JSON DB API automatically creates a "changeid" field with change-tracking functionality.

    Change tracking is optional in the CTDB and ISAM APIs. The application must create a 64-bit integer field and assign change-tracking functionality to it.

Request Example

"fields": [
  {
    "name": "signed_int32",
    "type": "integer",
    "autoValue": "incrementOnInsert"
  }
]
  

Response Example

{
  "result": {
    "dataFormat": "objects",
    "data": [
      {
        "changeIdField": "changeId",
        "createRecByteIndex": false,
        "databaseName": "ctreeSQL",
        "fieldDelimiterValue": 0,
        "fields": [
          {
            "autoValue": "incrementOnInsert",
            "defaultValue": null,
            "length": null,
            "name": "signed_int32",
            "nullable": true,
            "primaryKey": 0,
            "scale": null,
            "type": "integer"
          }
        ]
      }
    ]
  },
  "errorCode": 0,
  "errorMessage": "",
  "authToken": "replaceWithAuthTokenFromCreateSession"
}

This optional property specifies the default value of a field. It defaults to "" if no value is specified. You can specify any JSON value within the documented limits of the property.

Example

"fields": [
  {
    "name": "databaseName",
    "type": "varchar",
    "defaultValue": null
  }
]

This property is an integer that specifies the length of a table field. See also Data types.

It is required to set the length of the following fixed-length data types:

  • "char" (between 1 and 65,500 bytes)

  • "binary" (between 1 and 65,500 bytes).

It is required to set the maximum length for the following variable-length data types:

  • "varchar" (between 1 and 65,500 bytes).

  • "varbinary" (between 1 and 65,500 bytes).

It is optional to set the maximum length of the "json" data type, which defaults to 2 gigabytes. You may set its maximum length between 1 and 65,500 bytes.

It is optional to set the maximum length of the "number" and "money" data types, which default to 32 numeric digits. You can change the "length" to limit the precision of the number of digits to the left of the decimal point.

  • "number" and "money" are always stored as 32 decimal digits. Using a length less than 32 does not benefit storage.

  • You may optionally use "length" to specify fewer than 32 total digits to limit the maximum number of digits in the field. For example, a length of 4 allows numbers such as 12, 123, 1234, 12.34, and 0.1234, but not 12345, 123.45, or 0.12345.

  • You must always use "scale" to set the number of decimal places to the right of the decimal point, which must be less than or equal to the length. For example, "money" with a scale of 2, defaults to 30 digits to the left of the decimal point and 2 digits to the right, and "money" with a scale of 4, defaults to 28 digits to the left of the decimal point and 4 digits to the right.

 The "length" property is ignored for other data types because they have predefined lengths. For example, "lvarchar" and "lvarbinary" always have a maximum length of 2GB.

Note

"nchar" and "nvarchar" are only supported in FairCom's special UCS-2 server edition. These field types allocate two bytes to each character. Because UCS-2 is inefficient, FairCom recommends its standard database, which supports modern, efficient, variable-length UTF-8 characters.

  • "nchar" can be between 1 and 65,500 bytes.

  • "nvarchar" can be between 1 and 65,500 bytes.

Request example

Create a table that contains all field types that use the "length" property.

"fields": [
  {
    "name": "a",
    "type": "char",
    "length": 16
  },
  {
    "name": "b",
    "type": "varchar",
    "length": 65500
  },
  {
    "name": "c",
    "type": "lvarchar"
  },
  {
    "name": "d",
    "type": "binary",
    "length": 16
  },
  {
    "name": "e",
    "type": "varbinary",
    "length": 65500
  },
  {
    "name": "f",
    "type": "lvarbinary"
  },
  {
    "name": "g",
    "type": "json"
  },
  {
    "name": "h",
    "type": "json",
    "length": 65500
  },
  {
    "name": "j",
    "type": "number",
    "scale": 32
  },
  {
    "name": "k",
    "type": "number",
    "scale": 4
  },
  {
    "name": "i",
    "type": "number",
    "length": 12,
    "scale": 2
  },
  {
    "name": "l",
    "type": "money",
    "scale": 2
  },
  {
    "name": "m",
    "type": "money",
    "scale": 4
  },
  {
    "name": "n",
    "type": "money",
    "length": 12,
    "scale": 2
  }
] 

The optional "name" property is a case-sensitive string from 1 to 64 bytes in length. It is a new name for an existing field in a table. A field is not renamed when "name" is zero-length or omitted..

  • A zero-length "name" is invalid.

  • A client should enforce the uniqueness of the "name".

Request example

"fields": [
  {
    "name": "field1",
    "type": "varchar",
    "newName": "company"
  }
]

The "nullable" property is an optional Boolean. When true, it allows a field to contain a NULL value. To require a field to have a non-null value, set "nullable" to false.

"fields": [
  {
    "name": "company",
    "type": "varchar",
    "nullable": true 
  }
]

This optional property identifies a table's primary key.

Note

The best practice is not to use the "primaryKeyFields" or "primaryKey" properties, so the "createTable" action will automatically create a primary key field named "id" with a unique index named "id_pk".

Each table created by the JSON DB API has a primary key that uniquely identifies each record.

"createTable" automatically adds the "id" field as the primary key to your table. It makes "id" an auto-increment bigint field and indexes the field with a unique index named "id_pk". Using the "id" field as the primary key is a best practice.

You can specify one or more fields to be the primary key of the table instead of the "id" field. To do so, you must add the "primaryKeyFields" property to "createTable" or use the "fields" property's "primaryKey" to specify which field(s) are in the primary key.

Note

You should not use both the  "primaryKeyFields" and "primaryKey" properties together.

If multiple fields are specified for the key, the index is named "pk" . If only one field is specified for the key, the index is named "<fieldname>_pk".

If you use the "primaryKey" property to specify multiple fields as the primary key, the assigned value from 1 to n specifies the order of the fields in the primary key. Assign "primaryKey": 1 to the first field in the primary key, "primaryKey": 2 to the second, and so forth. If you create a primary key with multiple fields, the index is named "pk". If you specify just one field, the index is named "<fieldname>_pk".

Example

"fields": [
  {
    "name": "a",
    "type": "tinyint",
    "primaryKey": 1
  },
  {
    "name": "b",
    "type": "smallint",
    "primaryKey": 2
  },
  {
    "name": "c",
    "type": "integer",
    "primaryKey": 3
  }
]

The "scale" property is required only for the "number" and "money" data types because they require fixed precision. It is ignored for all other data types. See also Data types. The scale specifies the number of fixed decimal places to the right of the decimal point. Its value must always be less than or equal to the field's length.

The value of "scale" must be an integer from 0 to the number of digits specified by the "length" property. The maximum length is 32, which allows the scale to have up to 32 digits. The default value of length is 32.

A scale of 0 creates an integer number. A scale equal to the length creates a number that can only have a fractional value.

The "money" field type must have a scale of 2 or 4. The default is 4.

You may optionally use the "length" property to specify fewer than 32 total digits to limit the total number of digits available to the number. A length limit reduces the maximum size of the scale. For example, a length of 3 allows the scale of a "number" to be 0, 1, 2, or 3. 

Table 2. Example numbers allowed in "number" and "money" field types with a length of 4 and a scale from 0 to 4.

"length"

"scale"

Zero with Fixed Precision

Closest Positive Number to Zero

Closest Negative Number to Zero

Furthest Positive Number from Zero

Furthest Negative Number from Zero

Furthest Positive Fractional Number from Zero

Furthest Negative Fractional Number from Zero

Miscellaneous Examples

4

0

0

1

-1

9999

-9999

N/A

N/A

1234; 12

4

1

0.0

0.1

-0.1

999.9

-999.9

0.9

-0.9

123.4; 12.0

4

2

0.00

0.01

-0.01

99.99

-99.99

0.99

-0.99

12.34; 12.00

4

3

0.000

0.001

-0.001

9.999

-9.999

0.999

-0.999

1.234; 1.200

4

4

0.0000

0.0001

-0.0001

0.9999

-0.9999

0.9999

-0.9999

0.1234; 0.1200



Request Example

Create a table that contains all field types that use the "scale" property.

"fields": [
  {
    "name": "j",
    "type": "number",
    "scale": 32
  },
  {
    "name": "k",
    "type": "number",
    "scale": 4
  },
  {
    "name": "i",
    "type": "number",
    "length": 12,
    "scale": 2
  },
  {
    "name": "l",
    "type": "money",
    "scale": 2
  },
  {
    "name": "m",
    "type": "money",
    "scale": 4
  },
  {
    "name": "n",
    "type": "money",
    "length": 12,
    "scale": 2
  }
]

The required "type" property specifies the field's data type. It has no default value. See Data types for the limits, valid values, and whether "length" and "scale" are required.

Request example

"fields": [
  {
    "name": "j",
    "type": "number"
  }
]

The "metadata" property is an optional JSON object. It exists primarily for the user interface to find integration information. By default, it is an empty JSON object.

  • It contains a flexible set of properties.

  • It typically contains tags and description properties.

Example

{
  "description": "",
  "tags": [""],
  "yourOwnProperties": "usage, purpose, notes, location, etc.",
}

The "retentionPolicy" property controls how messages are persisted. This property is optional.

If not specified, the default found in the services.json file is used. Initially, it is "autoPurge".

retentionPolicy values:
  • "autoPurge"

    This is the default. It is automatically applied when a new topic is created. It is preferred because it allows FairCom's servers to automatically remove messages that are older than the retention time. This helps ensure message data does not consume all storage space. It also minimizes storage costs and speeds up data access. The server partitions a table into multiple files so it can efficiently delete expired files.

  • "neverPurge"

    This stores messages on disk and never removes them. This is useful when you need the entire history of the message stream. If message velocity is high, this can consume all storage space and cause an outage. The server creates a non-partitioned table, which is slightly faster than a partitioned table because it stores all records in one file.

The "retentionPeriod" property specifies how many units of data to retain. It must be an integer value from 1 to 100. It refers to the unit of time specified by the "retentionUnit" property — for example, if "retentionPeriod" is 14 and "retentionUnit" is "day", then message data is retained for 14 days. This property is optional.

  • Periodically, the system increments the age of each table partition.

    • "Minute" units are incremented at the zero second of each minute, whether the table partition was created 1 second before or 59 seconds before.

    • "Day" units are incremented at midnight GMT, not midnight of the local UTC time zone. A table partition becomes one day old at midnight GMT, whether it was created one second before or 23 hours and 59 seconds before.

    • "Week" units are incremented at midnight GMT on the last day of each week, even if the table partition was created one second before. The last day of the week is Saturday GMT.

    • "Month" units are incremented at midnight GMT on the last day of each month.

    • "Year" units are incremented at midnight GMT on Dec 31.

  • "retentionPeriod" implicitly calculates an upper bound on how many partitions are able to accumulate on your hard drive. However, partitions are not deleted just because this calculated number of partitions is reached. The system also does not restrict the deletion of all partitions.

  • If the FairCom database is shut down for a month, when the database is started up again, all partitions that are retained for less than one month are immediately deleted.

  • If someone purposely or accidentally sets the date to a future date, all partitions immediately become older, and auto-deletion ensues accordingly.

When partitions are auto-purged, some data are maintained "forever" in a global index. Auto-purge does not prevent these files from growing without bounds and filling up your hard drive.

If not specified, the default found in the services.json file is used. Initially, it is 4 (weeks).

Automatically purging data is important to ensure that retained data does not consume all storage and shut down the computer. The default value of 4 weeks allows FairCom's servers to store 1 TB of messages when 200 topics send one 2K message per second.

Note

  • If the value is not an integer from 1 to 100, FairCom's servers set it to the default value.

  • Smaller numbers improve SQL performance.

  • Each time the "retentionPeriod" cycles, FairCom's servers automatically and efficiently delete expired data.

  • The "retentionUnit" and "retentionPeriod" properties are used only when the "retentionPolicy" is set to "autoPurge".

  • FairCom's servers only use the "retentionPeriod" property when the "retentionPolicy" is "autoPurge".

  • The "retentionPeriod" can be changed to retain fewer or more messages. Changing it does not necessarily destroy existing data, but data may expire more quickly or be retained longer.

  • The "retentionPeriod" and "retentionUnit" properties control data granularity as well as the retention time.  In other words, "retentionPeriod" defines how many sets of data are stored, and "retentionUnit" defines how often data is purged.

    For example, if "rententionPeriod" is set to 14 , the server stores 14 sets of data. At the beginning of the 15th cycle, the server automatically purges the oldest set of data. If "retentionUnit" is set to day, then data will be purged daily. If set to "week", then data will be purged weekly.

  • The current calendar date affects purging.

    FairCom's servers automatically purge all retained data that has expired. This is noticeable when FairCom's servers come online after having been offline for a long time. When a server comes back online, it automatically purges all expired data.

    For example, if a FairCom server is offline for four weeks when it comes online, it will completely purge all retained data that has a retention time of less than 4 weeks.

Each time this unit cycles, FairCom purges expired messages. For example, if you want a week's worth of messages to be purged once a week, set "retentionUnit" to "week" . This property is optional.

If not specified, the default found in the services.json file is used. Initially, it is "week"

  • This property is used in concert with "retentionPeriod" to determine retention time.

  • "retentionUnit" values:

    • "minute"

    • "hour"

    • "day"

    • "week"

    • "month"

    • "year"

    • "forever"

Note

  • For best performance, set the "retentionUnit" to a value that keeps "retentionPeriod" between 5 and 30

  • When you set "retentionUnit" property to "forever" the server will not purge messages. This setting is the same as setting "retentionPolicy" to "neverPurge".

  • The "retentionUnit" and "retentionPeriod" properties are used only when the "retentionPolicy" is set to "autoPurge".

The "tableName" property contains the name of the table in the database where the event occurred. It is a non-zero-length string.

See table name in System limits for table naming requirements and limitations.

A table in DBnotify is defined by "databaseName", "ownerName" and "tableName" or by "dataFilePath".

The "transformSteps" property is an array of transform step objects. 

Different actions interpret "transformSteps": [] differently.

  • In the "alterIntegrationTable" action, "transformSteps" is optional. Setting it to [] removes transform steps from the integration table.

  • In the "createIntegrationTable" action, "transformSteps" is optional. Setting it to [] is the same as setting it to null or omitting it.

  • In the "testIntegrationTableTransformSteps" actions, "transformSteps" is required; thus, omitting it or setting it to [] or null is an error.

Each transform step object contains the required "transformStepMethod" property. It also supports the following optional properties:

  • "transformStepName"

  • "transformStepService"

Each transform step method also supports unique properties that are defined below.

"transformStepMethod": "javascript"

  • Required properties

    • "codeName"

  • Optional properties

    • "ownerName"

    • "databaseName"

"transformStepMethod": "tableFieldsToJson"

  • Required properties

    • "mapOfPropertiesToFields"

"transformStepMethod": "jsonToTableFields"

  • Required properties

    • "mapOfPropertiesToFields"

"transformStepMethod": "jsonToDifferentTableFields"

  • Required properties

    • "mapOfPropertiesToFields"

    • "targetTableName"

  • Optional properties

    • "targetOwnerName"

    • "targetDatabaseName"

The "codeName" property is a required string from 1 to 64 bytes. It is the name of a code package that runs when a record is inserted into an integration table. See "codeName" for more information.

It is an error to set "codeName" to the empty string "".

The "databaseName" property is an optional string from 1 to 64 bytes that specifies the database that contains an object, such as a table or code package. If it is set to null or is omitted, it defaults to the default database of the JSON Action session, see "createSession" and the "defaultDatabaseName" property. 

You specify this property when you want to use a different database instead of the default. Your session's account must have the appropriate privileges to access the code package.

This property is useful because objects, such as tables and code packages, can have the same name in multiple databases. This feature allows you to create multiple environments in the same server and reuse the same JSON actions in each environment. For example, you can create "dev", "test", "stage", and "prod" databases on the same server and use the "defaultDatabaseName" or "databaseName" properties to specify the desired environment.

It is an error to set "databaseName" to the empty string "".

If no default database is specified during "createSession", the server sets the "defaultDatabaseName" to the "defaultDatabaseName" value specified in the services.json file.

The "ownerName" property is an optional string from 1 to 64 bytes that specifies the account that owns an object, such as a table or code package. If it is set to null or is omitted, it defaults to the account that created the JSON Action session, see "createSession" and the "defaultOwnerName" property. 

You specify this property when you want to use a different account instead of the default. Your session's account must have the appropriate privileges to access the code package. 

This property is useful because objects, such as tables and code packages, can have the same name in the same database as long as different accounts own each object. This feature allows you to create duplicate objects for different users on the same server and reuse the same JSON actions on those objects. For example, an administrator can copy objects from a production environment to her account so she can troubleshoot an issue using the same JSON actions, JavaScript, and SQL code.

It is an error to set "ownerName" to the empty string "".

If no default owner is specified during "createSession", the server sets the "defaultOwnerName" to the "defaultOwnerName" value specified in the services.json file.

The "mapOfPropertiesToFields" property takes fields in the table and maps them to a field containing JSON properties. It is an array of property map objects. Each object maps a field in a table to a JSON property in another field.

  • Required properties

    • "recordPath"

    • "fieldName"

  • Optional properties

    • "binaryFormat"

    • "numberFormat"

    • "variantFormat"

    • "dateFormat"

    • "timeFormat"

The optional "dateFormat" property specifies the format of a date or a datetime embedded in a JSON string. It applies to user-provided JSON and to server-generated JSON. The server uses it when it needs to transform or convert a date or datetime embedded in a JSON string into a FairCom date or timestamp. It also uses it when it needs to convert a date or datetime field value into a date embedded in a JSON string.

It is an enumerated string with one of the following values: "ccyy.mm.dd", "mm.dd.ccyy", "mm.dd.yy", "dd.mm.ccyy", "dd.mm.yy", "ccyymmdd", "yymmdd", "iso8601", and "utc".

The default value for "dateFormat" is the "defaultDateFormat" property defined in the "createSession" or "alterSession" actions. If it is omitted there, it defaults to the value of the "defaultDateFormat" property in the <faircom>/config/services.json file. If it is not there, the FairCom server defaults it to "iso8601" because the ISO8601 date is the defacto standard in JSON.

The enumerated string defines how the server parses a date in a JSON string and how it writes a date into a JSON string. The following key explains the parts of each enumerated value:

  • ccyy is a four-digit year (0000-9999).

  • yy is a two-digit year (00-99).

  • mm is a two-digit month (01-12).

  • dd is a two-digit day of the month (01-31).

  • hh is a two-digit hour (00-23).

  • . represents one character that can be one of the following values: /, ., or -.

  • "utc", "iso8601", and "ccyy.mm.dd" are the same.

The required "fieldName" property specifies a field in a record. Depending on the context, the server reads or writes the field's value. 

For example, in the "tableFieldsToJson" transform method, "fieldName" is the location where the transform step reads a value that it transforms.  In the "jsonToTableFields" and "jsonToDifferentTableFields" transform methods, "fieldName" is the location where the transform step writes a transformed value.

The "numberFormat" property is an optional, case-insensitive string enum. It defines the format of JSON numbers. The default value for "numberFormat" is the "defaultNumberFormat" defined in the "createSession" or "alterSession" actions. If it is omitted there, it defaults to the value of the "defaultNumberFormat" property in the <faircom>/config/services.json file.

When "numberFormat" occurs in "mapOfPropertiesToFields", it tells the server how to encode or decode a number assigned to a JSON property.

For example, including "numberFormat" in a "tableFieldsToJson" transform step controls if the server encodes a number in a JSON property as a number or a number embedded in a string.

Possible values:
  • "number"

    This causes the server to return numeric values as JSON numbers, such as -18446744073709551616.000144722494 .

    This is most efficient.

    JSON represents numbers are base-ten numbers that may have any number of digits.

    Large numbers, such as 18446744073709551616.000144722494 are known to cause problems with JSON parsers and some programming languages, such as JavaScript, which are limited to the smaller range and binary rounding errors of IEEE floating point numbers.

  • "string"

    This returns the server to embed numeric values in JSON strings, such as "18446744073709551616.000144722494" .

    This is slightly less efficient because it includes two extra double quote characters

    Returning numbers embedded in strings ensures JSON parsers and programming languages will not automatically convert the number to a numeric representation that loses precision, introduces rounding errors, truncates values, or generates errors. This allows your application to control how numbers are processed.

  • Omitted or set to null

    This defaults to "number".

Example request

{
  "action": "someAction",
  "responseOptions":
  {
    "numberFormat": "string"
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}

The "recordPath" property specifies the location in a record where the server reads or writes a JSON value. It specifies a field name followed by an optional JSONPath. Depending on the context, it refers to a value the server reads or writes. 

For example, in the "tableFieldsToJson" transform method, "recordPath" is the location where the transform step writes a transformed value.  In the "jsonToTableFields" and "jsonToDifferentTableFields" transform methods, "recordPath" is the location where the transform step reads the value that it transforms.

  • The "recordPath" property must always include a field name.

    • The server returns an error when the field name is missing or does not exist.

  • The "recordPath" property may include a JSONPath after the field name.

    • If no JSONPath follows the field, the "recordPath" property refers to the entire field, and the field is not required to contain a JSON document.

    • If a JSONPath follows the field, the "recordPath" property refers to a part of the JSON document inside the field.

Several FairCom APIs, such as the DB and Transform APIs, treat each record in each table as a JSON document. The top-level fields in the record are treated as top-level properties in the JSON document. In other words, you can think of each record as a JSON document, and you can use the "recordPath" property to refer to any field in the record and any JSON property or array item within a JSON field.

When the server writes a value to a "recordPath", it looks for the specified field and JSONPath and does the following.

  • If the specified field does not exist, the server returns an error.

  • If the JSONPath is not specified after the fieldname, the server writes the value directly to the field.

  • If the field's value does not contain a JSON document, the server returns an error.

  • If the JSONPath specifies a property or array item that does not exist in the field's JSON document, the server adds it.

  • If the JSONPath specifies a property or array item that already exists in the field's JSON document, the server replaces the value.

When the server reads a value from a "recordPath", it looks for the specified field and JSONPath and does the following.

  • If the specified field does not exist, the server returns an error.

  • If the JSONPath is not specified after the fieldname, the server reads the entire field value.

  • If the field's value does not contain a JSON document, the server returns an error.

  • If the JSONPath specifies a property or array item that does not exist in the field's JSON document, the server returns null because FairCom's data model treats a missing JSON property the same as one assigned to null.

  • If the JSONPath specifies a property or array item that already exists in the field's JSON document, the server replaces the value.

Note

Unlike "propertyPath", a "recordPath" includes the name of the field that contains the JSON document.

Simple "recordPath" example

For example, a recordPath of "temperature" refers to a field named "temperature".

Example record in an integration table

The following record contains three fields: id, source_payload, and create_ts.

id

source_payload

create_ts

1

{
  "humidity": 
  [
    {
      "temperature": 20.1,
      "pressure": 1003
    }
  ]
}

"2025-07-07T14:14:02.012"

JSON representation of the example record

The following JSON shows how the JSON DB and Transform APIs represent the previous record. The top-level properties are fields in the integration table.

{
  "id": 1,
  "source_payload": 
  {
    "humidity": 
    [
      {
        "temperature": 20.1,
        "pressure": 1003
      }
    ]
  },
  "create_ts": "2025-07-07T14:14:02.012"
}

"recordPath" properties for each value in the example record

"recordPath"

Field Value

"recordPath": "id"

1

"recordPath": "source_payload"

{
  "humidity": 
  [
    {
      "temperature": 20.1,
      "pressure": 1003
    }
  ]
}

"recordPath": "source_payload.humidity"

[
  {
    "temperature": 20.1,
    "pressure": 1003
  }
]

"recordPath": "source_payload.humidity[0]"

{
  "temperature": 20.1,
  "pressure": 1003
}

"recordPath": "source_payload.humidity[0].temperature"

20.1

"recordPath": "source_payload.humidity[0].pressure"

1003

"recordPath": "create_ts"

"2025-07-07T14:14:02.012"

The required "recordPath" property specifies the location of a JSON property in a record. It starts with the name of a field in the table followed by an optional JsonPath to a JSON property within that field.

The optional "timeFormat" property specifies the format of a time or a datetime embedded in a JSON string. The server uses it when it needs to transform or convert a time or datetime embedded in a JSON string into a FairCom time or timestamp. It also uses it when it needs to convert a time or datetime field value into a time embedded in a JSON string.

It is an enumerated string with one of the following values: "hh.mm.ss.ttt", "hh.mm.am/pm", "hh.mm.ss.am/pm", "hh.mm.ss", "hh.mm", "hhmm", "iso8601", and "utc".

The default value for "timeFormat" is the "defaultTimeFormat" property defined in the "createSession" or "alterSession" actions. If it is omitted there, it defaults to the value of the "defaultTimeFormat" property in the <faircom>/config/services.json file. If it is not there, the FairCom server defaults it to "iso8601" because the ISO8601 date is the defacto standard in JSON.

The enumerated string defines how the server parses a time in a JSON string. The following key explains the parts of each enumerated value:

  • hh is a one- or two-digit hour (0-24).

  • mm is a two-digit minute (00-59).

  • ss is a two-digit second (00-59).

  • ttt is a fraction of a second with up to 3 digits of precision (.0-.999).

  • . represents one character that can be one of the following values: :, ., -, or /.

  • "utc", "iso8601", and "hh.mm.ss.ttt" are the same.

The "variantFormat" property tells the server how to format the values of variant fields in its response to your request.

The "variantFormat" property has one of the following values: "binary", "json", "string", and "variantObject". It tells the server how to store and return values stored in variant fields. The default value is "json".

  • The server applies the "variantFormat" property to all variant fields affected by a JSON action.

  • If you want to control the variant format of each field, set the "variantFormat" property to "variantObject" and use variant objects to set the variant type and encoding of each variant field.

The following sections describe each value of the "variantFormat" property.

"variantFormat": "binary"
  • Use the "variantFormat": "binary" setting to encode a variant field's value as a JSON string.

  • The "binaryFormat" property specifies how to encode the binary value.

    • The "binaryFormat": "hex" setting uses hexadecimal to encode a binary value in a JSON string.

    • The "binaryFormat": "base64" setting uses Base64 to encode a binary value in a JSON string.

    • The "binaryFormat": "byteArray" setting uses an array of integer numbers to encode each byte in the binary value.

  • When "variantFormat" is "binary", the server sets the variant's type to "binary" and stores raw bytes in the variant field.

  • The "binary" variant type ensures maximum compatibility and performance across all FairCom APIs, including JSON DB, SQL, CTDB, and ISAM.

  • The server does not validate the binary value, which can be any sequence of bytes.

"variantFormat": "json"
  • Use the "variantFormat": "json" setting to encode a variant field's value as a JSON value.

    • A JSON value can be an object, array, string, number, true, false, or null.

    • A binary field value is returned in a JSON string.

    • The "binaryFormat" property specifies the format of a binary variant value embedded in a JSON string.

    • The "numberFormat" property causes the server to return numbers as JSON numbers or JSON strings.

  • When "variantFormat" is "json", the server sets the variant's type to "json" and stores a JSON value in the variant field.

    • The server validates JSON before it assigns it to a variant field.

    • The server converts a variant field to valid JSON before it returns the value of a variant field.

  • When "variantFormat" is set to "json" in "responseOptions" and the "type" of variant object is "binary", the JSON API returns the binary variant value embedded in a string or as a byte array depending on the "binaryFormat" property in "responseOptions". In other words, when "variantFormat" is set to "json" in "responseOptions", the API returns a JSON value. All variant values can be returned as native JSON values except for binary values because JSON cannot represent them. Thus, when a variant has a binary value and the response option is JSON, the API embeds the binary value in a JSON string according to the value of "binaryFormat".

  • The server converts variant values to and from JSON as follows:

    • JSON null: The server does not store a JSON null; instead it marks the variant field as NULL. If the field is not nullable, the API returns an error.

    • JSON string: The server stores a JSON string in the variant field as is. It includes the double quotes before and after the string's value and stores escaped characters without decoding them. For example, the server stores the JSON string, "my // string",  as "my // string". The server returns a JSON string exactly as it stores it.

    • JSON number: The server stores a JSON number in the variant field as is. A number consists of the following ASCII characters 1234567890+-.eE. For example, the server stores the JSON number -123.45  as the ASCII characters -123.45. The server returns a JSON string exactly as it stores it.

    • JSON true & false: The server stores a JSON true and false in the variant field as is. It stores and returns the ASCII characters true or false.

    • JSON object & array: The server stores a JSON object and array as is. When it validates the JSON, it minimizes whitespace while preserving the UTF-8 characters representing the actual object or array. For example, the server stores the array [1,2,3]  as the UTF-8 characters [1,2,3].

"variantFormat": "variantObject"
  • Use the "variantFormat": "variantObject" setting to encode a variant field's value as a variant object.

  • When the "insertRecords" and "updateRecords" actions have "variantFormat": "variantObject" in "params", you must assign a variant object to each variant field.

  • A JSON action returns a variant object for a variant field value when you put "variantFormat": "variantObject" in "responseOptions".

"variantFormat": "string"
  • Use the "variantFormat": "string" setting to encode a variant field's value as a JSON string.

  • This setting in the "responseOptions" property causes all "getRecords..." actions to return string values from variant fields.

    • Binary values are returned as a JSON string containing an embedded binary value. The "binaryFormat" property specifies how to encode the binary value.

    • Number values are returned as a JSON number embedded in a string, such as "123.45". The server ignores the "numberFormat" property in the "responseOptions" object.

    • Boolean values are returned as a "true" or "false" string.

    • String values are returned as a JSON string, which may contain JSON escaped characters.

    • JSON values are returned embedded in a string.

      • A JSON object is escaped, encoded, and embedded in a string, such as "{\"key\": \"value\"}".

      • A JSON array is escaped, encoded, and embedded in a string, such as "[1, \"my string\", true ]".

      • A JSON string is returned as a JSON string.

      • A JSON number is embedded in a JSON string, such as "-123.456".

      • A JSON true is returned as "true".

      • A JSON false is returned as "false".

      • A JSON null is returned as "null".

  • This setting in the "params" property for "insertRecords" and "updateRecords" actions requires a string value to be assigned to each variant field.

    • FairCom does not recommend this setting because it can only store strings in variant fields. Consider using the other "variantFormat" options to store many more types of data, such as binary, JSON objects, JSON arrays, numbers, etc.

The "targetDatabaseName" property is the optional name of the database that contains the target table. See

"databaseName" for more information.

The "targetOwnerName" property is the optional name of the account that owns the target table. See "ownerName" for more information.

The required "targetTableName" property specifies the name of the target table that has its transform steps replaced by this action.

Note

The fully qualified name of a table includes the database, owner, and table names.

The "transformStepMethod" property is a required string that specifies the type of transform, such as the "javascript" transform method that runs JavaScript to change the table's data or the "jsonToTableFields" transform method that extracts values from properties in a JSON field and stores them in other fields.

Note

The "transformStepMethod" property replaces the deprecated "transformActionName" property.

The value of the "transformStepMethod" affects the value of the "transformService" property. The following table defines the possible values of the "transformService" property when combined with the "transformStepMethod". Notice that some transform step methods are built into the server and do not require you to specify the "transformService".

"transformStepMethod" value

"transformService" value

"jsonToTableFields"

null or omitted

"tableFieldsToJson"

null or omitted

"jsonToDifferentTableFields"

null or omitted

"javascript"

"v8TransformService"

"siemensUdtPayloadToJson"

"siemensUdtPayloadToJson"

Note

If the "transformStepMethod" property is set to "javascript", the "transformService" property must be set to "v8TransformService".

The "transformStepName" property is an optional string that assigns a name to each transform step.

The "transformStepService" property is an optional string that specifies the name of a transform service, which is the user-defined name for a library (.dll, .so, .dylib) that implements the transform step method.

This property allows you to register your own transform libraries or use an older version of a FairCom library for backward compatibility.

Transform services are defined in the services.json file under the "transformServices" section. You can add and remove transform libraries to this list, such as your own transform libraries or specific versions of FairCom's transform libraries. Use the "serviceName" property to give each transform library a unique transform service name and use the "serviceLibrary" property to specify the filename of the library that implements the transform step method. On Windows the library filename ends with .dll. On Linux it ends with .so. On MacOS it ends with .dylib. Lastly, you must enable the transform service by setting "enabled" to true.

Example "transformServices" section in the services.json file.

"transformServices": [
  {
    "serviceName": "v8TransformService",
    "serviceLibrary": "v8transformservice.dll",
    "enabled": true
  }
],

Note

If the "transformStepMethod" property is set to "javascript", the "transformStepService" property must be set to "v8TransformService" or to a user-defined transform service name associated with the "v8transformservice.dll" service library.