-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Trying to use the New-LMAlertRule function to add a rule that has a -ResourceProperties associated with it. A simple command below results in the debug that follows:
New-LMAlertRule -Name Test -Priority 70000 -ResourceProperties @{"test"="value"} -EscalatingChainId 2 -Debug
DEBUG: ============ LogicMonitor API Debug Info ==============
DEBUG: Command: New-LMAlertRule | Method: POST | Timestamp: 2026-01-13 14:54:07.984
DEBUG: Parameters: Name: Test | Priority: 70000 | ResourceProperties: {test} | EscalatingChainId: 2 | Debug: True
DEBUG: Endpoint: /santaba/rest/setting/alert/rules
DEBUG: Portal: xxxxsandbox.logicmonitor.com
DEBUG: Headers: User-Agent: Logic.Monitor-PowerShell-Module/7.7.5 | Content-Type: application/json | Authorization: LMv1 XXXXXXX| X-Version: 3
DEBUG: Request Payload:
DEBUG: {
DEBUG: "priority": 70000,
DEBUG: "name": "Test",
DEBUG: "escalatingChainId": 2,
DEBUG: "resourceProperties": {
DEBUG: "test": "value"
DEBUG: },
DEBUG: "levelStr": "All"
DEBUG: }
DEBUG: ========================================================
New-LMAlertRule : Invalid json body - Cannot deserialize value of type `java.util.ArrayList` from Object value (token `JsonToken.START_OBJECT`)
At line:1 char:1
+ New-LMAlertRule -Name Test -Priority 70000 -ResourceProperties @{"tes ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (https://lphsand...ing/alert/rules:String) [New-LMAlertRule], LMException
+ FullyQualifiedErrorId : LMAPIError.ClientError,New-LMAlertRule
There are a couple of issues with the Debug results as it relates to the resourceProperties object.
- it should be an array object of hashes []
- the hash itself should be in the format name:, value: as noted below:
"resourceProperties": [
{
"name":"test",
"value":"value"
}
],
When I put this in Postman it works
Metadata
Metadata
Assignees
Labels
No labels