Automic Workload Automation

 View Only

REST calls via powershell [solution inside]

  • 1.  REST calls via powershell [solution inside]

    Posted Mar 21, 2018 06:54 AM
    Hey guys,

    as there have been some post on REST calls lately and I also received a powershell newsletter covering that subject. I tried to implement Automic REST calls in powershell. At first I thought it's very easy, but turns out it's a little tricky, cause the powershell command does not support basic authentication out of the box.

    So here is a basic example that I'd like to share with you ...

    $uri            = "http://<aeserver>:8088/ae/api/v1/<client>/executions/<runid>"
    $base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f "<user>/<department>","<password>")))

    irm -uri $uri -Method GET -Headers @{"Authorization"="Basic $base64AuthInfo"}

    This should work in powershell 3.0 and above.

    Matthias