Forum Discussion
Todd_Theoret
8 years agoNeophyte
3 hours ago, Sarah Terry said:Hi Todd - The REST API does indeed support the serviceProperties field. I'm unable to replicate the issue you're seeing, but it appears the response is also missing the value for the 'checkpoints' object. Are you using a script to make the request?
Thanks for the reply Sarah. Yes, I am utilizing a PowerShell script. Almost identical to the example at: https://www.logicmonitor.com/support/rest-api-developers-guide/overview/using-logicmonitors-rest-api/ except I added: $queryParams = '?size=900'
<# account info #> $accessId = 'unique' $accessKey = 'unique' $company = 'cwps' <# request details #> $httpVerb = 'GET' $resourcePath = '/service/services'
$queryParams = '?size=900'
<# Construct URL #> $url = 'https://' + $company + '.logicmonitor.com/santaba/rest' + $resourcePath + $queryParams <# Get current time in milliseconds #> $epoch = [Math]::Round((New-TimeSpan -start (Get-Date -Date "1/1/1970") -end (Get-Date).ToUniversalTime()).TotalMilliseconds) <# Concatenate Request Details #> $requestVars = $httpVerb + $epoch + $resourcePath + $queryParams <# Construct Signature #> $hmac = New-Object System.Security.Cryptography.HMACSHA256 $hmac.Key = [Text.Encoding]::UTF8.GetBytes($accessKey) $signatureBytes = $hmac.ComputeHash([Text.Encoding]::UTF8.GetBytes($requestVars)) $signatureHex = [System.BitConverter]::ToString($signatureBytes) -replace '-' $signature = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($signatureHex.ToLower())) <# Construct Headers #> $auth = 'LMv1 ' + $accessId + ':' + $signature + ':' + $epoch $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" $headers.Add("Authorization",$auth) $headers.Add("Content-Type",'application/json') <# Make Request #> $response = Invoke-RestMethod -Uri $url -Method Get -Header $headers <# Print status and body of response #> $status = $response.status $body = $response.data| ConvertTo-Json Write-Host "Status:$status" Write-Host "Response:$body"
Related Content
- 10 months ago
- 2 years ago
- 2 years ago
- 2 years ago