FairCom provides special API actions for the MTConnect connector. The MTConnect service must be enabled in order to complete FairCom MTConnect API actions.
Note A connector is a bridge between a device/software and an integration table.
Request examples
Minimal
{
"action": "createInput",
"params": {
"inputName": "mymtconnect",
"serviceName": "mtconnect",
"thingName": "PLC 74",
"settings": {
"host": "195.167.1.5:5000",
"propertyMapList": [
{
"propertyPath": "device1Action1PositionInMillimeters",
"mtconnectDeviceUuid": "Device1",
"mtconnectDataItemId": "Device1_Act1_1",
"dataType": "string"
}
]
},
"tableName": "mtconnectTable"
},
"authToken": "replaceWithAuthTokenFromCreateSession"
}Maximal
{
"api": "hub",
"action": "createInput",
"params": {
"inputName": "mymtconnect",
"serviceName": "mtconnect",
"thingName": "PLC 74",
"settings": {
"host": "195.167.1.5:5000",
"dataCollectionIntervalMilliseconds": 5000,
"propertyMapList": [
{
"propertyPath": "temperature.value", //Deprecated
"dataType": "string",
"defaultValue": "-1",
"mtconnectDeviceUuid": "X1_373f-4ab9-9c7a-173edd23e4f3",
"mtconnectDataItemId": "X1_Stamper1_Temperature",
"mtconnectCategoryPropertyPath": "temperature.category",
"mtconnectComponentNamePropertyPath": "temperature.component",
"mtconnectDataItemIdPropertyPath": "temperature.dataItemId",
"mtconnectDataNamePropertyPath": "temperature.dataName",
"mtconnectDataTypePropertyPath": "temperature.dataType",
"mtconnectDeviceNamePropertyPath": "temperature.device",
"mtconnectDeviceUuidPropertyPath": "temperature.deviceUuid",
"mtconnectSequencePropertyPath": "temperature.sequence",
"mtconnectTimestampPropertyPath": "temperature.timestamp"
},
{
"tagName": "device1Action1PositionInMillimeters",
"mtconnectDeviceUuid": "Device2",
"mtconnectDataItemId": "Device2_Act1_1",
"dataType": "string"
},
{
"tagId": 18,
"mtconnectDeviceUuid": "Device3",
"mtconnectDataItemId": "Device3_Act1_1",
"dataType": "string"
}
]
},
"ownerName": "admin",
"tableName": "mtconnectTable",
"retentionPolicy": "autoPurge",
"retentionPeriod": 30,
"retentionUnit": "day",
"metadata": {
}
},
"authToken": "replaceWithAuthTokenFromCreateSession"
}
Response examples
Success
{
"result": {},
"requestId": "00000007",
"errorCode": 0,
"errorMessage": ""
}Failure
{
"result": {},
"requestId": "00000002",
"debugInfo": {
"request": {
"api": "hub",
"action": "createInput",
"params": {
"inputName": "MTConnect2",
"serviceName": "mtconnect",
"settings": {
"host": "195.167.1.5:5000",
"dataCollectionIntervalMilliseconds": 5000,
"propertyMapList": [
{
"propertyPath": "temperature",
"mtconnectDeviceUuid": "9617890b-7526-9f6b-214f-0c860ace6485",
"mtconnectDataItemId": "rf",
"dataType": "integer",
"defaultValue": 0
}
]
},
"ownerName": "admin",
"tableName": "mtconnectTable",
"dataBase": "faircom",
"retentionPolicy": "autoPurge",
"retentionPeriod": 30,
"retentionUnit": "day",
"metadata": {}
},
"requestId": "00000002",
"debug": "max",
"authToken": "replaceWithAuthTokenFromCreateSession"
}
},
"errorCode": 12012,
"errorMessage": "Not possible to start MTConnect service instance [MTConnect2] - Not able to load MTConnect property mapping. Invalid property dataType value 'integer' [9617890b-7526-9f6b-214f-0c860ace6485/temperature]. Possible values are 'boolean' and 'string'.",
"authToken": "replaceWithAuthTokenFromCreateSession"
}
Properties
Request properties ("params")
| Property | Description | Defualt | Type | Limits (inclusive) |
|---|---|---|---|---|
description |
The "description" property assigns a description to a connector. |
Optional with default of ""
|
string | 1 to 512 bytes |
enabled |
The "enabled" property turns on or off an input or output connector. Thus, it pauses or starts data collection or delivery. |
Optional with default of true
|
Boolean |
|
enabledFilter |
The "enabledFilter" property returns input connections that are enabled or not. Omit or set to null to match all connections. |
Optional with default of null
|
Boolean |
|
inputName |
The "params": {
"inputName": "modbusTCP",
"serviceName": "modbus"
} |
Required - No default value |
string | 1 to 100 bytes |
metadata |
The "metadata" property contains user-defined properties that add keywords and tags about the code package. The server indexes this field with a full-text index so you can search for any word or phrase to find code packages. |
Optional with default of {}
|
object | 0 or more key/value pairs |
ownerName |
The 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 If no default owner is specified during |
Optional with default of the session's "defaultOwnerName" property |
string | 1 to 64 bytes |
purpose |
The "purpose" property specifies the purpose of the thing. You can use it for fast partial lookups and filtering. |
Optional with default of "unknown" |
string |
1 to 64 bytes Values are managed in the Label API with the group |
retentionPeriod |
The |
Optional with default of |
integer |
1 to 100
|
retentionPolicy |
The If not specified, the default found in the
retentionPolicy values:
|
Optional with default of |
string |
|
retentionUnit |
The If not specified, the default found in the
|
Optional with default of |
string |
|
runningFilter |
The "runningFilter" property returns input connections that are running or not. Omit or set to null to match all connections. |
Optional with default of null
|
Boolean |
|
serviceName |
The See the The following services are available as of the V5 release:
|
Required - No default value | string | 1 to 64 bytes |
settings |
The |
Optional with default of {}
|
object | |
|
settings .dataCollectionIntervalMilliseconds |
The |
Optional with default of 10000 (10 seconds). |
integer |
0 and negative values are invalid. |
|
settings .host |
The "host" property specifies the IP or hostname of the Rest resource, including the port. |
Required - No default | string | 1 to 1024 bytes |
|
settings .propertyMapList |
The "propertyMapList" property specifies which data the connector requests and where to put it in the generated JSON. |
Required - No default value | array of objects |
zero or more objects containing zero or more of the following properties:
|
|
settings propertyMapList .dataType |
The If If |
Required - No default value | string |
|
|
settings propertyMapList .defaultValue |
The "defaultValue" property specifies the default value of a field. It is used when a record is inserted without specifying a value for the field. The server coerces the string value into the proper field type. |
Optional with default of ""
|
string | 0 to 65,500 bytes |
|
settings propertyMapList .mtconnectCategoryPropertyPath |
The |
Required - No default value | string | No limit |
|
settings propertyMapList .mtconnectComponentNamePropertyPath |
The "mtconnectDataItemId" property specifies the identifier of the data that the MTConnect connector collects. For more details, see "mtconnectDataItemId". |
Required - No default value | string | No limit |
|
settings propertyMapList .mtconnectDataItemId |
The |
Optional with default of null
|
string | JSON path |
|
settings propertyMapList .mtconnectDataItemIdPropertyPath |
The |
Optional with default of null
|
string | JSON path |
|
settings propertyMapList .mtconnectDataNamePropertyPath |
The |
Optional with default of null
|
string | JSON path |
|
settings propertyMapList .mtconnectDataTypePropertyPath |
The |
Optional with default of null
|
string | JSON path |
|
settings propertyMapList .mtconnectDeviceNamePropertyPath |
The |
Optional with default of null
|
string | JSON path |
|
settings propertyMapList .mtconnectDeviceUuid |
The |
Optional with default of null
|
string | JSON path |
|
settings propertyMapList .mtconnectDeviceUuidPropertyPath |
The |
Optional with default of null
|
string | JSON path |
|
settings propertyMapList .mtconnectSequencePropertyPath |
The |
Optional with default of null
|
string | JSON path |
|
settings propertyMapList .mtconnectTimestampPropertyPath |
The |
Optional with default of null
|
string | JSON path |
|
settings propertyMapList .propertyPath |
The "propertyPath" property specifies the JSON path in the JSON document where the connector puts the data it collects. It is mutually exclusive with the "tagName" and "tagId" properties. |
Required - No default value | string | JSON path |
|
settings propertyMapList .tagId |
The "tagId" property associates a tag with a value being collected by a connector. It is mutually exclusive with the "tagName" and "propertyPath" properties. See tagId for more details. |
Conditional - No default value | integer | If present, it must contain the ID of an existing tag, which is an integer from 0 to 9223372036854770000.Note FairCom recommends using this property instead of "propertyPath". |
|
settings propertyMapList .tagName |
The "tagName" property associates a tag with a value being collected by a connector. It is mutually exclusive with the "tagId" and "propertyPath" properties. See tagName for more details. |
Conditional - No default value | string |
If present, it must contain the name of an existing tag. Note FairCom recommends using this property instead of |
status |
The "status" property assigns an active or inactive status to a thing. An inactive status is like a soft delete. |
Optional with default of "active" | string enum |
|
tableName |
The The table name must start with an upper or lowercase letter, must not contain special characters other than underscore
"params": {
"tableName": "ctreeTable"
} |
Required - No default value | string | 1 to 64 bytes |
thingId |
The "thingId" property associates a connector with a device or software application. It is mutually exclusive with the "thingName" property. See thingId for more details. |
Optional with default of null
|
integer | If present, it must contain the ID of an existing thing, which is an integer form 0 to 9223372036854770000. |
thingName |
The "thingName" property associates a connector with a device or software application. It is mutually exclusive with the "thingId" property. See thingName for more details. |
Optional with default of null
|
string | 1 to 64 bytes |
Response properties ("result")
| Property | Description | Type | Limits (inclusive) |
|---|---|---|---|
data |
The |
array of objects | The action determines its contents. |
|
data .enabled |
|
boolean |
truefalse
|
|
data .running |
The "running" property is true when an input connector is collecting data or an output connector is delivering data; otherwise, it is false. A disabled connector will never be running. An enabled connector may or may not be running. |
Boolean |
|
|
data .settings |
The |
object |
See these pages for connector specific properties: |
|
data settings .propertyMapList |
The "propertyMapList" property specifies which data the connector requests and where to put it in the generated JSON. |
array of objects |
See these pages for connector specific properties: |
|
data settings propertyMapList .propertyPath |
The "propertyPath" property specifies the JSON path in the JSON document where the connector puts the data it collects. It is mutually exclusive with the "tagName" and "tagId" properties. |
string | JSON path |
|
data settings propertyMapList .tagId |
The "tagId" property associates a tag with a value being collected by a connector. It is mutually exclusive with the "tagName" and "propertyPath" properties. See tagId for more details. |
integer | If present, it must contain the ID of an existing tag, which is an integer from 0 to 9223372036854770000.Note FairCom recommends using this property instead of "propertyPath". |
|
data settings propertyMapList .tagName |
The "tagName" property associates a tag with a value being collected by a connector. It is mutually exclusive with the "tagId" and "propertyPath" properties. See tagName for more details. |
string |
If present, it must contain the name of an existing tag. Note FairCom recommends using this property instead of |
|
data .stopCode |
The "stopCode" property is 0 when the connector is successfully connected to its device or software; otherwise, it is non-zero. |
integer |
-2147483648 to 2147483647
|
|
data .stopReason |
The "stopReason" property is "" when the input connector is collecting data; otherwise, it is a non-empty string. |
string | 0 to 256 bytes |
|
data .thingId |
The "thingId" property associates a connector with a device or software application. It is mutually exclusive with the "thingName" property. See thingId for more details. |
integer | If present, it must contain the ID of an existing thing, which is an integer form 0 to 9223372036854770000. |
|
data .thingName |
The "thingName" property associates a connector with a device or software application. It is mutually exclusive with the "thingId" property. See thingName for more details. |
string | 1 to 64 bytes |