-
Notifications
You must be signed in to change notification settings - Fork 361
Quick Start: Local Listener Beta (HTTP API)
The Local Listener option exposes the local taskt client via HTTP API. The API can be called by other systems that support HTTP requests or natively by other taskt clients. This quick start guide outlines how to enable and consume the Local Listener functionality.
From the Script Builder screen, select Options > Settings. From the Settings Screen, Click the Local Listener tab.
-
Note: Add Rule to Windows Firewall if applicable - Open Windows Firewall > Inbound Rules Pane > New Rule
- Select "Port" Rule and click Next
- Select "TCP" and Specific Local Port. Enter Port Number (19312 is default) and click Next
- Select "Allow the Connection" and click Next
- Select "Private" or "Domain and click Next
- Enter a Rule Name and click Finish -
Check if Local Listening should start on Startup
-
Check the "Enable Local Listening" option
-
Enter Provide Port Number (19312 is default)
-
Check if clients should provide an Authentication Key. Use default or provide your own key.
The status label will update once taskt is listening. The client will note the internal IP address and port number. You will need to execute against that IP and port number. Logs will also be generated in the Root/Logs folder. You may need to restart the client for these settings to take effect.
API Endpoint | Description |
---|---|
/ExecuteScript |
Enables an external client to run script data or indicate a script to be executed |
/AwaitScript |
Similar to Execute Script but API will not return until the script has finished |
/ExecuteCommand |
Similar to Execute Script but for executing a single command (JSON) |
/EngineStatus |
Returns a value whether the engine is currently executing or not |
/RestartTaskt |
Immediately restart the taskt client |
taskt has first-party support to consume this API and can connect to other clients through standard commands. The "Remote Commands" group contains 2 additional commands:
- Remote API: Provides Functionality to Get Engine Status and Restart taskt on another client
- Remote Task: Provides Functionality to execute raw script data, run a local script, or run a remote script on another taskt client
A full sample task highlighting and sampling this functionality is provided under Sample Scripts\3.x Use Cases\Remote Execution Sample [3.3.0.0].xml.
You can call the taskt API from an external application. For testing this functionality you can use PostMan or a similar application that supports sending HTTP requests. Note, if the "Require Authentication" option is checked, the client will need to provide an "AuthKey" parameter and the value must match the value configured on the remote client.
Sample Request:
Sample Request Code:
POST /EngineStatus HTTP/1.1
Host: 192.168.86.200:19312
Content-Type: text/plain
AuthKey: e52cdb2d-7c4c-4ae3-a231-55ce1638acc2
User-Agent: PostmanRuntime/7.20.1
Accept: */*
Cache-Control: no-cache
Postman-Token: 33ecd72e-ab2c-4ff8-b649-874466629386,3197fb53-b35f-495c-9ad9-1f29f7b7c53c
Host: 192.168.86.200:19312
Accept-Encoding: gzip, deflate
Content-Length: 0
Connection: keep-alive
cache-control: no-cache
Sample Request:
Sample Request Code:
POST /RestartTaskt HTTP/1.1
Host: 192.168.86.200:19312
Content-Type: text/plain
AuthKey: e52cdb2d-7c4c-4ae3-a231-55ce1638acc2
User-Agent: PostmanRuntime/7.20.1
Accept: */*
Cache-Control: no-cache
Postman-Token: 56f3afa2-0ae9-4ef1-8b5c-bb510b8063f2,79935be7-0ab3-48b2-b138-59e5f0f8bb55
Host: 192.168.86.200:19312
Accept-Encoding: gzip, deflate
Content-Length: 0
Connection: keep-alive
cache-control: no-cache
Sample Request:
Sample Request Code:
POST /EngineStatus HTTP/1.1
Host: 192.168.86.200:19312
Content-Type: text/plain
AuthKey: e52cdb2d-7c4c-4ae3-a231-55ce1638acc2
User-Agent: PostmanRuntime/7.20.1
Accept: */*
Cache-Control: no-cache
Postman-Token: 33ecd72e-ab2c-4ff8-b649-874466629386,3197fb53-b35f-495c-9ad9-1f29f7b7c53c
Host: 192.168.86.200:19312
Accept-Encoding: gzip, deflate
Content-Length: 0
Connection: keep-alive
cache-control: no-cache
Remote Script Sample Request:
Remote Script Sample Code:
POST /ExecuteScript HTTP/1.1
Host: 192.168.86.200:19312
Content-Type: text/plain
AuthKey: e52cdb2d-7c4c-4ae3-a231-55ce1638acc2
ScriptLocation: Hi.xml
User-Agent: PostmanRuntime/7.20.1
Accept: */*
Cache-Control: no-cache
Postman-Token: f2a4515c-1cfb-4c6d-96f2-52d9abc23aeb,1f7e8a73-4d59-4740-86a2-de9740c3a8fd
Host: 192.168.86.200:19312
Accept-Encoding: gzip, deflate
Content-Length: 0
Connection: keep-alive
cache-control: no-cache
Note: When providing the ScriptLocation parameter, if you do not provide a full path (ex. C:\Users\Name\Documents\taskt\My Scripts\SomeScript.xml) then the application will search for the file in the root path. Failure to locate the file will return "Client Script Location Not Found: Hi2.xml. You should always check the value of the response returned to ensure that th script was invoked successfully.
Script Data Sample Request:
POST /ExecuteScript HTTP/1.1
Host: 192.168.86.200:19312
Content-Type: text/plain
AuthKey: e52cdb2d-7c4c-4ae3-a231-55ce1638acc2
ScriptData: <?xml version="1.0" encoding="utf-8"?><Script xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><Commands><ScriptAction><ScriptCommand xsi:type="MessageBoxCommand" CommandID="47aaa426-52ed-4b3f-ab93-9fceeff696a0" CommandName="MessageBoxCommand" IsCommented="false" SelectionName="Show Message" DefaultPause="0" LineNumber="1" PauseBeforeExeucution="false" CommandEnabled="true" v_ExecutionLocation="rem" v_Message="Hello World!" v_AutoCloseAfter="0" /></ScriptAction></Commands><Variables><ScriptVariable><VariableName>vResult</VariableName><VariableValue xsi:type="xsd:string"></VariableValue></ScriptVariable></Variables></Script>
User-Agent: PostmanRuntime/7.20.1
Accept: */*
Cache-Control: no-cache
Postman-Token: 978d0f69-fd7c-4c8c-9751-3b7c867f0790,1bfff7cf-14de-41a9-9f14-657eb1e0bf79
Host: 192.168.86.200:19312
Accept-Encoding: gzip, deflate
Content-Length: 0
Connection: keep-alive
cache-control: no-cache
If you intend to send raw script data, you must ensure that there are no newline characters. To help account for this scenario, the API also supports receiving data encoded in UTF8 base64 format. The following script is the same as the previous, however, note that the script data is encoded in base64. When received by the taskt Client, it is deserialized and executed in the same manner:
POST /ExecuteScript HTTP/1.1
Host: 192.168.86.200:19312
Content-Type: text/plain
AuthKey: e52cdb2d-7c4c-4ae3-a231-55ce1638acc2
ScriptData: PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxTY3JpcHQgeG1sbnM6eHNpPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYS1pbnN0YW5jZSIgeG1sbnM6eHNkPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYSI+DQogIDxDb21tYW5kcz4NCiAgICA8U2NyaXB0QWN0aW9uPg0KICAgICAgPFNjcmlwdENvbW1hbmQgeHNpOnR5cGU9Ik1lc3NhZ2VCb3hDb21tYW5kIiBDb21tYW5kSUQ9IjQ3YWFhNDI2LTUyZWQtNGIzZi1hYjkzLTlmY2VlZmY2OTZhMCIgQ29tbWFuZE5hbWU9Ik1lc3NhZ2VCb3hDb21tYW5kIiBJc0NvbW1lbnRlZD0iZmFsc2UiIFNlbGVjdGlvbk5hbWU9IlNob3cgTWVzc2FnZSIgRGVmYXVsdFBhdXNlPSIwIiBMaW5lTnVtYmVyPSIxIiBQYXVzZUJlZm9yZUV4ZXVjdXRpb249ImZhbHNlIiBDb21tYW5kRW5hYmxlZD0idHJ1ZSIgdl9FeGVjdXRpb25Mb2NhdGlvbj0icmVtIiB2X01lc3NhZ2U9IkhlbGxvIFdvcmxkISIgdl9BdXRvQ2xvc2VBZnRlcj0iMCIgLz4NCiAgICA8L1NjcmlwdEFjdGlvbj4NCiAgPC9Db21tYW5kcz4NCiAgPFZhcmlhYmxlcz4NCiAgICA8U2NyaXB0VmFyaWFibGU+DQogICAgICA8VmFyaWFibGVOYW1lPnZSZXN1bHQ8L1ZhcmlhYmxlTmFtZT4NCiAgICAgIDxWYXJpYWJsZVZhbHVlIHhzaTp0eXBlPSJ4c2Q6c3RyaW5nIj48L1ZhcmlhYmxlVmFsdWU+DQogICAgPC9TY3JpcHRWYXJpYWJsZT4NCiAgPC9WYXJpYWJsZXM+DQo8L1NjcmlwdD4=
User-Agent: PostmanRuntime/7.20.1
Accept: */*
Cache-Control: no-cache
Postman-Token: 0c2b7578-ca48-43f9-8468-9ba6f42ef84e,11f9703e-457d-4194-aae7-4d1fbf026be6
Host: 192.168.86.200:19312
Accept-Encoding: gzip, deflate
Content-Length: 0
Connection: keep-alive
cache-control: no-cache
This API functions the exact same as Execute Script API, however, it will not return a result until the script has finished (Success or Error). This API should be used synchronously as there is no queue support yet. You can return a custom value back to the calling client by setting variable taskt.Result
before the script has finished executing. If you decide not the set the taskt.Result
variable, the client will return Successfully Completed Script
as the default response.
Configuring Custom Response
API Returning Sample Response
POST /AwaitScript HTTP/1.1
Host: 192.168.86.200:19312
Content-Type: text/plain
AuthKey: e52cdb2d-7c4c-4ae3-a231-55ce1638acc2
ScriptData: PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxTY3JpcHQgeG1sbnM6eHNpPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYS1pbnN0YW5jZSIgeG1sbnM6eHNkPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYSI+DQogIDxDb21tYW5kcz4NCiAgICA8U2NyaXB0QWN0aW9uPg0KICAgICAgPFNjcmlwdENvbW1hbmQgeHNpOnR5cGU9Ik1lc3NhZ2VCb3hDb21tYW5kIiBDb21tYW5kSUQ9IjNjZWY4N2JlLTI3MWMtNDdiNy04ZDU2LTQzMzk4NjZmNjk4YSIgQ29tbWFuZE5hbWU9Ik1lc3NhZ2VCb3hDb21tYW5kIiBJc0NvbW1lbnRlZD0iZmFsc2UiIFNlbGVjdGlvbk5hbWU9IlNob3cgTWVzc2FnZSIgRGVmYXVsdFBhdXNlPSIwIiBMaW5lTnVtYmVyPSIxIiBQYXVzZUJlZm9yZUV4ZXVjdXRpb249ImZhbHNlIiBDb21tYW5kRW5hYmxlZD0idHJ1ZSIgdl9NZXNzYWdlPSJUZXN0aW5nIEF3YWl0ISIgdl9BdXRvQ2xvc2VBZnRlcj0iMCIgLz4NCiAgICA8L1NjcmlwdEFjdGlvbj4NCiAgICA8U2NyaXB0QWN0aW9uPg0KICAgICAgPFNjcmlwdENvbW1hbmQgeHNpOnR5cGU9IlZhcmlhYmxlQ29tbWFuZCIgQ29tbWFuZElEPSIzNTc4ZDQ3Mi05ZmRkLTQ5MTMtYTkxNi0zZGJjYjUwMzhjY2MiIENvbW1hbmROYW1lPSJWYXJpYWJsZUNvbW1hbmQiIElzQ29tbWVudGVkPSJmYWxzZSIgU2VsZWN0aW9uTmFtZT0iU2V0IFZhcmlhYmxlIiBEZWZhdWx0UGF1c2U9IjAiIExpbmVOdW1iZXI9IjIiIFBhdXNlQmVmb3JlRXhldWN1dGlvbj0iZmFsc2UiIENvbW1hbmRFbmFibGVkPSJ0cnVlIiB2X3VzZXJWYXJpYWJsZU5hbWU9InRhc2t0LlJlc3VsdCIgdl9JbnB1dD0iV29vIGhvbyB0aGlzIGlzIG15IHJlc3VsdCIgLz4NCiAgICA8L1NjcmlwdEFjdGlvbj4NCiAgPC9Db21tYW5kcz4NCiAgPFZhcmlhYmxlcyAvPg0KPC9TY3JpcHQ+
User-Agent: PostmanRuntime/7.20.1
Accept: */*
Cache-Control: no-cache
Postman-Token: 8bf7ec94-4eac-4515-a64e-3a194e980407,a89548b3-5bc2-444c-b751-f6c16ce30240
Host: localhost:19312
Accept-Encoding: gzip, deflate
Content-Length: 0
Connection: keep-alive
cache-control: no-cache
This API enables you to execute an individual command remotely instead of an entire script. To get the JSON of the command, you can right-click any command in the builder and select "View Code". Note you can pass the JSON as a single string or in Base64 format. This API supports only executing a single command at a time. If you require multiple commands, consider calling this API multiple times or simply passing a script to the ExecuteScript
API.
POST /ExecuteCommand HTTP/1.1
Host: Localhost:19312
Content-Type: text/plain
AuthKey: e52cdb2d-7c4c-4ae3-a231-55ce1638acc2
CommandData: {"$type":"taskt.Core.Automation.Commands.MessageBoxCommand, taskt","v_Message":"{vres}","v_AutoCloseAfter":0,"CommandID":"40aae430-f6bc-4d04-861c-4f6f03dd0601","CommandName":"MessageBoxCommand","IsCommented":false,"SelectionName":"Show Message","DefaultPause":0,"LineNumber":2,"PauseBeforeExeucution":false,"DisplayForeColor":"SteelBlue","v_Comment":null,"CommandEnabled":true,"CustomRendering":true}
User-Agent: PostmanRuntime/7.20.1
Accept: */*
Cache-Control: no-cache
Postman-Token: 4e8930bd-90f9-4c8d-8351-093226620488,3c260e1c-a6f0-4efd-83b3-c019996fdff6
Host: localhost:19312
Accept-Encoding: gzip, deflate
Content-Length: 0
Connection: keep-alive
cache-control: no-cache