JSON to different table API reference
API reference for the JSON to different table transform method
Request examples
Minimal request
{ "api": "hub", "action": "createTransform", "params": { "transformName": "TestTransform2", "transformActions": [ { "inputFields": [ "In1" ], ], "transformStepMethod": "jsonToDifferentTableFields", "transformParams": { "targetDatabaseName": "faircom", "targetTableName": "test_out2", "mapOfPropertiesToFields": [ { "propertyPath": "out1", "name": "out1", "type": "VARCHAR", "length": 200 } ] } } ] }, "authToken": "replaceWithAuthTokenFromCreateSession" }
{ "api": "transform", "action": "createTransform", "params": { "transformName": "singlePropertyToMultipleFieldsTranform", "transformActions": [ { "inputFields": [ "source_payload" ], "outputFields": [ "temperature_a", "temperature_b", "temperature_c" ], "transformStepMethod": "jsonToTableFields", "transformParams": { "targetTableName": "my_table", "mapOfPropertiesToFields": [ { "propertyPath": "temperature", "name": "temperature_a", "type": "DOUBLE" }, { "propertyPath": "temperature", "name": "temperature_b", "type": "DOUBLE" }, { "propertyPath": "temperature", "name": "temperature_c", "type": "DOUBLE" } ] } } ] }, "requestId": "00000002", "authToken": "replaceWithAuthTokenFromCreateSession" }
{ "api": "hub", "apiVersion": "1.0", "requestId": "00000006", "action": "createTransform", "params": { "transformName": "TestTransform2", "transformActions": [ { "inputFields": [ "In1" ], "outputFields": [ "out1", "out2" ], "transformService": null, "transformStepMethod": "jsonToDifferentTableFields", "transformParams": { "targetDatabaseName": "faircom", "targetTableName": "test_out2", "mapOfPropertiesToFields": [ { "propertyPath": "out1", "name": "out1", "type": "VARCHAR", "length": 200 }, { "propertyPath": "out2", "name": "out2", "type": "DOUBLE" } ] }, metadata": { "myTag": "my data" } } ] }, "responseOptions": { "binaryFormat": "base64", "dataFormat": "arrays", "numberFormat": "number" }, "authToken": "replaceWithAuthTokenFromCreateSession" }
Note
The jsonToDifferentTableFields
transform will automatically add the following fields to the target table if they do not already exist. When the transform inserts a new row into the target table, it auto-populates these fields:
change_id
create_ts
id
out1
out2
source_database
source_id
source_schema
source_table
If any existing field or index has the same name as one of these but with a mismatched schema definition, the transform will fail and prompt the user to fix this conflict.
{ "result": {}, "requestId": "00000007", "errorCode": 0, "errorMessage": "", "authToken": "replaceWithAuthTokenFromCreateSession" }
API reference for the JSON to different table transform method
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
"params"
property summariesProperty | Description | Default | Type | Limits | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|
specifies | Required - No default value | array of objects | |||||||||
| (optional) specifies the name of the transform service | Required when | string |
| |||||||
| specifies the name of the transform action | Required - No default value | string |
| |||||||
| (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 "transformParams"
property is a required object that can be an empty object or contain one or more properties needed by the "transformAction"
.
The "mapOfPropertiesToFields"
property is a required array of "mapOfPropertiesToFields"
objects. It defaults to an empty array.
Example
"mapOfPropertiesToFields": [ { "propertyPath": "out1", "name": "out1", "type": "VARCHAR", "length": 200 } ]
The "propertyPath"
property is a string that specifies the property that will be read in JSON.
The "name"
property is a string that specifies the destination in the integration table for the data that was read from the propertyPath.
The "type"
property specifies the type of the integration table being written to.
The "length"
property is an integer that specifies the length of the "name"
property.
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"
.
|
| Definition |
---|---|---|
|
| |
|
| |
|
| |
|
| The |
|
|
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.