HP Insight Control Server Provisioning 7.3 Update 1 Administrator Guide

HTTP/1.1 200 OK
Date: Mon, 26 Aug 2013 19:52:13 GMT
Content-Type: application/json;charset=UTF-8
Via: 1.1 ::1
cache-control: no-cache
Transfer-Encoding: chunked
{"type":"OsdPaginatedCollection","members":[{"status":"error","jobUserName":"administrator","nameOfJobType":
"ProLiant OS - Windows 2008 R2 SP1 Standard x64 Scripted Install","running":"false","jobProgress":null,"jobResult":
[{"jobServerUri":"/rest/os-deployment-servers/70001","jobResultCompletedSteps":1,"jobResultTotalSteps":
16,"jobResultLogDetails":"Running OS Build Plan ProLiant OS - Windows 2008 R2 SP1 Standard x64
Scripted Install (OSBuildPlanRef:170001) against server (ServerRef:70001)\n\nStep 1 of 16:
Run OGFS Script 'Validate Custom Attributes'\nStep 2 of 16: Run OGFS Script 'Check iLO Service'\nFailed To check
iLO service:Server model VMWARE VIRTUAL PLATFORM, manufacturer VMWARE, INC. does not support
iLO\n\nCheck iLO Service failed with exit code 120.\n","jobResultErrorDetails":"","jobMessage":"Check iLO
Service failed with exit code 120."}],"typeOfJobType":"BP","uriOfJobType":"/rest/os-deployment-build-
plans/170001","jobDeviceGroups":[],"jobServerInfo":[{"serverName":"localhost-VMware-VMware
Virtual Platform-70001","jobServerInclusionStatus":"INCLUDED_INCLUSION_STATUS","jobStatusOnServer":
"FAILURE_STATUS","jobServerUri":"/rest/os-deployment-servers/70001","deviceType":"os-deployment-servers"}],
"name":"ProLiant OS - Windows 2008 R2 SP1 Standard x64 Scripted Install","state":"STATUS_FAILURE",
"description":"Run OS Build Plan","uri":"/rest/os-deployment-jobs/690001","category":null,
"created":"2013-08-22T19:09:38.000Z","modified":"2013-08-22T19:09:55.000Z","eTag":"2013-08-
22T19:09:55.000Z"}],"count":1,"total":1,"start":0,"prevPageUri":null,"nextPageUri":null,"uri":null,
"category":null,"created":null,"modified":null,"eTag":null}
Below is an example Powershell v2 script that will get the full details of all the jobs on the appliance
or for a single job identified by job id:
#########################################################################################
# functions for the script
function showJobDetails($thisjob)
{
# get the details for a single job
$jobdetails = $webclient.DownloadString("https://$applianceip$thisjob")
$sepstring = "--------------------------------------------------------------------------"
Write-Host "`n`n$sepstring`n$thisjob JSON:`n" $jobdetails.Replace(",",",`n")
.Replace("\r\n","**r**n`n").Replace("\r","**r`n").Replace("\n","**n`n").Replace("**","\")
}
#########################################################################################
# setup default values for script
$applianceip = "10.1.1.7"
$username = "april"
$password = "applianceadmin"
$joblistonly = $false
#########################################################################################
# process command line arguments
foreach($arg in $args)
{
switch -regex ($arg)
{
"-[uU](.+)" { $username = $matches[1]; Write-Host "setting user to: $username"; }
"-[pP](.+)" { $password = $matches[1]; Write-Host "setting password to: $password"; }
"-[aA](.+)" { $applianceip = $matches[1]; Write-Host "setting applianceip to: $applianceip"; }
"-[lL](.+)" { $joblistonly = $true; Write-Host "only show job list, not details"; }
"-[jJ](.+)" { $onejob = $matches[1]; Write-Host "getting details only for job $onejob"; }
default { Write-Host "unknown argument: $arg"; }
}
}
#########################################################################################
# set up script variables/values
$loginurl = "https://$applianceip/rest/login-sessions"
$joblisturl = "https://$applianceip/rest/os-deployment-jobs"
$loginbody = "{`"userName`":`"$username`",`"password`":`"$password`"}"
#########################################################################################
# accept all certificates as part of handshake - used so that self-signed certs
# from IC server provisioning are accepted
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
$webclient = New-Object System.Net.WebClient
#########################################################################################
# set up the request headers
$webclient.Headers.add('content-type', 'application/json')
$webclient.Headers.add('accept', 'application/json')
#########################################################################################
# attempt to login
$loginresponse = $webclient.uploadString($loginurl, $loginbody)
REST call to list jobs in job history 111