Skip to main content

Table to JSON API reference

API reference for the table to JSON transform method

Request examples

Minimal request

{
    "api": "hub",
    "action": "createTransform",
    "params": {
        "transformName": "TestTransform1",
        "transformActions": [
            {
                "inputFields": [
                    "In1"
                ],
                "outputFields": [
                    "Out1"
                ],
                "transformStepMethod": "tableFieldsToJson",
                "transformParams": {
                    "mapOfFieldsToProperties": [
                        {
                            "propertyPath": "In1",
                            "fieldName": "In1"
                        }
                    ]
                }
            }
        ]
    },
    "authToken": "replaceWithAuthTokenFromCreateSession"
}
{
    "api": "hub",
    "apiVersion": "1.0",
    "requestId": "00000006",
    "action": "createTransform",
    "params": {
        "transformName": "TestTransform1",
        "transformActions": [
            {
                "inputFields": [
                    "In1",
                    "In2",
                    "In3",
                    "In4",
                    "In5"
                ],
                "outputFields": [
                    "Out1"
                ],
                "transformStepMethod": "tableFieldsToJson",
                "transformParams": {
                    "metadata": {
                       "myTag": "my data"
                   }
               }
            }
        ]
    },
    "responseOptions": {
        "binaryFormat": "base64",
        "dataFormat": "arrays",
        "numberFormat": "number"
    },
    "authToken": "replaceWithAuthTokenFromCreateSession"
}
{
    "result": {},
    "requestId": "00000003",
    "errorCode": 0,
    "errorMessage": "",
    "authToken": "replaceWithAuthTokenFromCreateSession"
}

API reference for the table to JSON transform method

API referenceJSON hub APItable API referencetable to JSONJSON transform

The "params" property is an object that contains an action's parameters. Each action defines its own required and optional properties. See System limits for a comprehensive look at property requirements and limitations.

Property summary

Table 1. "params" property summaries

Property

Description

Default

Type

Limits

transformActions

specifies "transformAction" objects

Required - No default value

array of objects

transformActions
.transformService

(optional) specifies the name of the transform service

Required when "transformStepMethod" is "javascript"; otherwise, it is optional with no default value

string

"javascript"
"siemensUdtPayloadToJson"
"v8TransformService"
transformActions
.transformStepMethod

specifies the name of the transform action

Required - No default value

string

"javascript"
"jsonToTableFields"
"tableFieldsToJson"
"jsonToDifferentTableFields"
"siemensUdtPayloadToJson"
transformActions
.transformStepName

(optional) allows the user to assign a name to each transform step

""

string

0 to 250 bytes

transformName

specifies the name of a transform process. The name cannot be one of the FairCom-provided transform names

Required - No default value

string

1 to 64 bytes



The "transformActions" property is an optional array of "transformAction" objects. It defaults to an empty array.

The "transformService" property is an optional string that specifies the name of the transform service.

Note

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

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

Definition

"jsonToTableFields"

null or omitted

"tableFieldsToJson"

null or omitted

"jsonToDifferentTableFields"

null or omitted

"javascript"

"v8TransformService"

The "javascript" transform method runs JavaScript code each time a record is inserted into an Integration table. The code can read the value of any field and write values to any field except the built-in fields, such as source_payload. See this tutorial.

"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 allows the user to assign a name to each transform step.