Retrieving REST based results from SMA Runbooks

In a previous example, I gave an example of running a simple Service Management Automation runbook using REST. This blog demonstrates how to retrieve output from a called runbook by using platform independent REST calls against the SMA Server.

Four steps exist in obtaining the output from an SMA Runbook:

The code below uses PowerShell to shows the four steps required in retrieving SMA output (although the REST calls would be the same in any programming language).

Retrieving SMA output with PowerShell CMDlets

Windows hosted processes can use PowerShell CMDlets to start a runbook and retrieve the results. Cmdlets simplify the process by removing the initial step of retrieving a runbook GUID as the Start-SMARunbook activity can resolve runbook names to GUIDs automatically. The cmdlet based code below is the equivalent of the REST orientated “longhand” above.