Skip to main content

How to start AFT! jobs via REST API but using the command-line

As of version 3.0, Syncplify.me AFT! has added the capability to start jobs via the START command-line switch and parameters. To be clear, unlike the RUN command (which executes a script from file in the context of whatever shell you invoked it) the START command will actually call a REST API for you to start the job within the context of the Syncplify.me AFT! system service.

First of all, you need to make sure you meet the prerequisites, which is basically only one: you need to create an API Key from inside AFT!'s web interface, and make sure such API Key can be used from the IP address you'll be calling it from. Here's an example API Key that will work when invoked from 127.0.0.1 (localhost):

image.png

Once you have the API Key, you can use it to invoke the START command via command-line.

Here's the simplest example, using only the API Key and the ID of the script you want to run:

.\aft.exe start -s "p3fEoexohdHj6SXrvuT8H8" -a "xiM2ruBm2QZkhTSN6BPd9BqmxVEBVbrgNYVMkNQb6hfj"

Once you have the API Key, you can use it to invoke the START command via command-line.

Here's a complete example, which also explicitly adds the optional HOST and PARAMETERS command-line payload:

.\aft.exe start -s "p3fEoexohdHj6SXrvuT8H8" -a "xiM2ruBm2QZkhTSN6BPd9BqmxVEBVbrgNYVMkNQb6hfj" --params "[{\`"name\`":\`"character\`",\`"value\`":\`"goofy\`"}]" --host "127.0.0.1:44399"

Both of these examples assume you're invoking them from PowerShell... please keep in mind that other shells (like cmd.exe or Unix/Linux shells) may have different string "escaping" mechanisms and notations.