Published: 2017-05-03
When there is a requirement to probe Request Management API from a SLA tool or a monitoring system validating and measuring availability, it could be necessary to initiate a web request from that tool/system. The below sample PowerShell script shows how that could be accomplished with authentication by querying the GetInstalledLicense method.
Replace values for $acctname and $password with the credential you created in the installer of Request Management API and the string servername with the name of the server hosting Request Management API.
$acctname = 'xyz123'; $password = 'xyz123'; $params = @{uri = 'https://servername:30033/admin/license/GetInstalledLicense/'; Method = 'Get'; #(or POST, or whatever) Headers = @{Authorization = 'Basic ' +[Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$($acctname):$($password)")); } #end headers hash table } #end $params hash table $var = invoke-restmethod @params $var
Comments
0 comments
Please sign in to leave a comment.