Skip to main content

Alternative (lower-level) way to start a script via PowerShell and REST API

With Syncplify AFT! you have quite a few different ways to run and/or start the execution of your secure file transfer jobs. One such way is via REST API. But how to invoke such REST API via PowerShell in an easy way? Here's an example script for you:

$Header = @{
    "X-API-Key" = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
$Body = @{
    jobType = "SCRIPT"
    scriptId = "xxxxxxxxxxxxxxxxxxxxxx"
$Parameters = @{
    Method      = "POST"
    Uri         = ""
    Headers     = $Header
    ContentType = "application/json"
    Body        = ($Body | ConvertTo-Json)
Invoke-RestMethod @Parameters -SkipCertificateCheck

All you need to do is substitute the censored (xxxxxx...) API Key and Script ID with your own values, and that's it, it'll work just fine.