Thank you lordmilko, very useful :)
api/getobjectproperty.htm?id=2101&name=businessprocessdefinitions
I didn't succeed to replace values with URL Encode :
editsettings?id=2101&businessprocessdefinitions_=%5B%7B%22objects%22%3A%5B%5D%2C%22warningthreshhold%2
2%3A75%2C%22errorthreshhold%22%3A50%2C%22channelname%22%3A%22channel1%22%7D%2C%7B%22objects%22%3A%5B%5D%2C%22warningthres
hhold%22%3A75%2C%22errorthreshhold%22%3A50%2C%22channelname%22%3A%22newchannel2%22%7D%5D
I use this decoded url :
editsettings?id=4454&businessprocessdefinitions_=[{"objects":[4455],"warningthreshhold":75,"errorthreshhold":50,"channelname":"aa"},{"objects":[4456],"warningthreshhold":75,"errorthreshhold":50,"channelname":"bb"}]
Encoded in this way :
editsettings%3Fid%3D4454%26businessprocessdefinitions_%3D%5B%7B%22objects%22%3A%5B4455%5D%2C%22warningthreshhold%22%3A75%2C%22errorthreshhold%22%3A50%2C%22channelname%22%3A%22aa%22%7D%2C%7B%22objects%22%3A%5B4456%5D%2C%22warningthreshhold%22%3A75%2C%22errorthreshhold%22%3A50%2C%22channelname%22%3A%22bb%22%7D%5D%0A
To use in this way (i'm on PowerShell 6.2) :
Invoke-WebRequest "https://$($properties.server)/api/editsettings%3Fid%3D4454%26businessprocessdefinitions_%3D%5B%7B%22objects%22%3A%5B4455%5D%2C%22warningthreshhold%22%3A75%2C%22errorthreshhold%22%3A50%2C%22channelname%22%3A%22aa%22%7D%2C%7B%22objects%22%3A%5B4456%5D%2C%22warningthreshhold%22%3A75%2C%22errorthreshhold%22%3A50%2C%22channelname%22%3A%22bb%22%7D%5D%0A&username=$($properties.username)&passhash=$token" -SkipCertificateCheck
Always I get an error "Invoke-WebRequest : Unauthorized".
I'm on PowerShell so the module is really interesting :
$sensor = Get-Sensor -Id 2101
$original = $sensor | Get-ObjectProperty -RawProperty businessprocessdefinitions_
$new = $original -replace "someChannelName","newChannelName"
$sensor | Set-ObjectProperty -RawProperty businessprocessdefinitions_ -RawValue $new -Force
But we use a self-signed certificate with HTTP disabled. The module works with a valid SSL certificate or with HTTP but not in HTTPS with a self-signed certificate. Even if I use -IgnoreSSL parameter I get this error :
Connect-PrtgServer : The remote certificate is invalid according to the validation procedure.
I'm going to glance at the module code but I'm not very skilled in C#.
Add comment