Here at Automation Logic we spend a lot of time talking to a huge variety of APIs (RESTful or otherwise). So it’s nice to know that PowerShell makes it easier than ever to send API calls from the Windows command line. Here’s a recent example we’ve used to talk to the HP Operations Orchestration (OO) API. You’ll need at least PowerShell version 3.
$username = "username" $password = "password" $auth = $user + ':' + $password $Encoded = [System.Text.Encoding]::UTF8.GetBytes($auth) $EncodedPassword = [System.Convert]::ToBase64String($Encoded) $headers = @{"Authorization"="Basic $($EncodedPassword)"} $contentType = "application/json" $url = "https://<hostname>:8443/oo/rest/latest/executions"
$flowInput = New-Object PSObject -Property @{ "inputName" = "inputValue" }
$flow = New-Object PSObject -Property @{ "uuid" = "flowUUID" "runName" = "Run name of the follow" "inputs" = $flowInput } $json=ConvertTo-Json $flow
$response = Invoke-RestMethod -Uri $url -Credential $creds -ContentType write-host $response
For those wondering what PowerShell is doing under the hood, here’s the rough equivalent as a cURL command: curl -H "Content-Type:application/json" -H "Accept:application/json" -X POST -d'{"uuid":"flowUUID","runName":"Run name of the flow","logLevel":"DEBUG", "inputs":{"inputName":"inputValue"}}' https://<hostname>:8443/oo/rest/latest/executions --user 'username:password'
curl -H "Content-Type:application/json" -H "Accept:application/json" -X POST -d'{"uuid":"flowUUID","runName":"Run name of the flow","logLevel":"DEBUG", "inputs":{"inputName":"inputValue"}}' https://<hostname>:8443/oo/rest/latest/executions --user 'username:password'
We work with our clients to de-risk and accelerate their business goals realisation. Our approach is based on tailoring our services to fit your needs leveraging our portfolio of strategy, execution, innovation and service delivery offerings to help you reach your objectives
We’re always on the lookout for exceptional talent and people who share our values. Even as we continue to grow, we maintain a family environment with respect and teamwork core to our culture.
Piotr Grześkowiak has been at Automation Logic for just over five years, starting out in our DevOps Academy after graduating in Computer Science with Information Security. During those 5 years, he’s gone from an engineer in training to a well respected senior engineer, trusted by the whole company. Piotr’s been on three Central Government client […]
We interviewed AL’s co-founders Kris & Norm about their journey building Automation Logic into the business it is over the last 12 years. From the values they’ve set in place, to the struggles they’ve faced. And obviously, because it’s pretty difficult not to mention it these days, the impact covid had.
A memoir of a Workload Migration engineer by Liam Rae-McLauchlan We’ve all read the blogs and articles about migrating to the Cloud and its benefits, but in practice it can be a daunting task. Maybe your organisation is planning to move to the cloud, or is already trying – up to 85% of enterprises are […]