REST API - Services "Properties"
Trying to get "serviceProperties" to populate when pulled via the REST API.
I add a Properties entry on a Web Service Check: Name - [account_name], Value - [TheoretDevelopment] but the results always come back empty. Tried various options.
Does the REST API actually support this field? Any assistance would be much appreciated.
Thank you!
| serviceProperties | The properties associated with the Service | JSON Object | "serviceProperties" : [ {"name" : "billing","value" : "website"}, {"name" : "team","value" : "TechOps"}, {"name" : "production","value" : "true"} ] |
{
"type": "webservice",
"id": 177,
"name": "careers.zzz.org",
"description": "If this site goes down, follow standard critical alert procedures per the client policy",
"serviceFolderId": 247,
"stopMonitoring": false,
"stopMonitoringByFolder": false,
"disableAlerting": false,
"individualSmAlertEnable": false,
"individualAlertLevel": "warn",
"overallAlertLevel": "critical",
"alertStatus": "none",
"alertStatusPriority": 100000,
"sdtStatus": "none-none-none",
"alertDisableStatus": "none-none-none",
"pollingInterval": 1,
"transition": 9,
"testLocation": "{\"all\":false,\"smgIds\":[1,2]}",
"globalSmAlertCond": 0,
"useDefaultLocationSetting": false,
"useDefaultAlertSetting": false,
"userPermission": "write",
"checkpoints": " ",
"serviceProperties": "",
"serviceStatus": "alive",
"isInternal": false,
"collectors": "",
"script": "",
"method": "tabledriven",
"ignoreSSL": true,
"pageLoadAlertTimeInMS": 30000,
"steps": ""
},
Todd_Theoret
OP9 years agoI was trying from the Group level as some of our clients (group) have 15+ Services. But you did solve the mystery. Thank you very much Sarah!
}
],
"serviceProperties": [
{
"name": "account_name",
"value": "At_Service_Level"
}
],
Sarah_Terry
·9 years agoAre the properties you're trying to pull set at the service level, or inherited from a group? The serviceProperties object will only display properties set for the service in question, and won't include any inherited properties (we'll be publishing a properties sub-resource in our next release that includes all service properties, including inherited properties, and labels them by type).
Todd_Theoret
OP9 years agoSarah, unfortunately the -Depth 5 did not pull the properties. I utilized the exact PowerShell example, with our creds of course.
"checkpoints": [
{
"id": 282,
"geoInfo": "Overall",
"smgId": 0
},
{
"id": 151899387,
"geoInfo": "US - Los Angeles",
"smgId": 1
},
{
"id": 281,
"geoInfo": "US - Washington DC",
"smgId": 2
}
],
"serviceProperties": [
],
Sarah_Terry
·9 years agoGot it - I think found the issue: When the script converts the response to JSON, it isn't catching those nested objects like checkpoints, serviceProperties, etc. If you add '-Depth 5' as an option when converting, such that the full line is '$body = $response.data | ConvertTo-Json -Depth 5', you'll see those nested JSON objects. I'll correct the example scripts - sorry for the confusion! Let me know if this doesn't fix your issue.
Todd_Theoret
OP9 years agoThanks 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'
Sarah_Terry
·9 years agoHi 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?