Show me an example
The following is a very basic "end of line" script that:
- Connects
- Generates a new tool record by calling an API
- Writes the unique data to the tool
Chart

JSON
{
"StartAt": "Connect via Adapter 1",
"MTSLLanguageVersion": "1.0",
"TimeoutSeconds": 30,
"States": {
"Connect via Adapter 1": {
"Type": "Task",
"Resource": "Product:Connect",
"Parameters": {
"CommunicationMethod": "CommunicationAdapter"
},
"ResultPath": "$.ConnectionStatus",
"Next": "Set Communication Target M18 Tool"
},
"Set Communication Target M18 Tool": {
"Type": "Task",
"Resource": "OpenLink:SendCommand",
"Parameters": {
"MessageType": "70",
"IsWrite": true,
"RouteType": "Tool",
"CommandBody": "01"
},
"ResultPath": "$.SetCommTarget",
"Next": "Write Default METCO Password"
},
"Write Default METCO Password": {
"Type": "Task",
"Resource": "OpenLink:SendCommand",
"Parameters": {
"MessageType": "01",
"IsWrite": true,
"RouteType": "Tool",
"CommandBody": "003B3333333333333333"
},
"ResultPath": "$.WriteDefaultPasswordResult",
"Next": "Allocate Tool Record"
},
"Allocate Tool Record": {
"Type": "Task",
"Resource": "Network:ApiCall",
"Parameters": {
"BaseUrl": "ManufacturingAPI",
"Method": "POST",
"Path": "/v1/tool/allocate",
"Body": {
"size": 1,
"productId": 0,
"client": {
"name": "<Software Client Running Script>",
"facility": "<Facility ID defined by ES19-1",
"timestamp.$": "$.ExecutionStartTime",
"version.$": "$.ClientVersion",
"user.$": "$.UserEmail"
}
}
},
"ResultSelector": {
"Device.$": "$.devices[0]"
},
"ResultPath": "$.Allocation",
"Next": "Write tool MPBID"
},
"Write tool MPBID": {
"Type": "Task",
"Resource": "OpenLink:WriteAndVerify",
"Parameters": {
"RouteType": "Tool",
"Address": "0004",
"Payload.$": "$.Allocation.Device.mpbid"
},
"ResultPath": "$.WriteMPBIDResult",
"Next": "Write tool BOD"
},
"Write tool BOD": {
"Type": "Task",
"Resource": "OpenLink:WriteAndVerify",
"Parameters": {
"RouteType": "Tool",
"Address": "0011",
"Payload.$": "States.DecimalToHex($.ExecutionStartTime)"
},
"ResultPath": "$.WriteBODResult",
"Next": "Write tool USER password"
},
"Write tool USER password": {
"Type": "Task",
"Resource": "OpenLink:WriteAndVerify",
"Parameters": {
"RouteType": "Tool",
"Address": "0043",
"Payload.$": "$.Allocation.Device.userPassword"
},
"ResultPath": "$.WriteUserPasswordResult",
"Next": "Write tool ADMIN password"
},
"Write tool ADMIN password": {
"Type": "Task",
"Resource": "OpenLink:WriteAndVerify",
"Parameters": {
"RouteType": "Tool",
"Address": "004B",
"Payload.$": "$.Allocation.Device.adminPassword"
},
"ResultPath": "$.WriteAdminPasswordResult",
"Next": "Write tool SERVICE password"
},
"Write tool SERVICE password": {
"Type": "Task",
"Resource": "OpenLink:WriteAndVerify",
"Parameters": {
"RouteType": "Tool",
"Address": "0053",
"Payload.$": "$.Allocation.Device.servicePassword"
},
"ResultPath": "$.WriteServicePasswordResult",
"Next": "Write tool METCO password"
},
"Write tool METCO password": {
"Type": "Task",
"Resource": "OpenLink:WriteAndVerify",
"Parameters": {
"RouteType": "Tool",
"Address": "005B",
"Payload.$": "$.Allocation.Device.metcoPassword"
},
"ResultPath": "$.WriteMetcoPasswordResult",
"Next": "Disconnect"
},
"Disconnect": {
"Type": "Task",
"Resource": "Product:Disconnect",
"ResultPath": "$.ConnectionStatus",
"End": true
}
}
}