What would the call be to set location inheritance to on and off?

I have tried the following:

/api/setobjectproperty.htm?id=groupID&name=location_&value=0

/api/setobjectproperty.htm?id=groupID&name=location_&value=1

Do I have the right name? Neither of those will change the setting on the group ID that is given.


Article Comments

Location inheritance is controlled via the locationgroup property

$id = 1001

Invoke-WebRequest http://prtg.example.com/editsettings?id=$id&locationgroup=0&username=prtgadmin&passhash=12345678

You can identify the correct name for any property by inspecting the name attribute of its input tag in the underlying HTML

Regards,

lordmilko


Mar, 2018 - Permalink

Sorry for my ignorance but... How do I "inspect the name attribute of its input tag in the underlying HTML"?


Mar, 2018 - Permalink

Thanks lordmilko. I have been using your PowerShell PRTGAPI module. How would I make this change using one of your powershell commands?


Mar, 2018 - Permalink
Get-Device -Id 1234 | Set-ObjectProperty InheritLocation $false

You can view all device and group properties modifiable with PrtgAPI by doing

Get-Help ObjectSettings

To identify the name attribute of HTML input tags, in Chrome press Ctrl+Shift+J, click the selector button (top left button in the window that opens) and select the element on the page you wish to inspect. You can also get an idea as to the raw names of things with PrtgAPI

C:\> Get-Device -Id 1234 | Get-ObjectProperty -Raw

name                                 : dc-1
active                               : 1
ipversion                            : 0
host                                 : 192.168.0.1
hostv6                               :
tags                                 : C_OS_Win
deviceicon                           : c_os_win.png
serviceurl                           : http://192.168.0.1
discoverytype                        : 1
devicetemplate                       : 0
devicetemplate__check                : 0
locationgroup                        : 1
...

As a general rule, the raw name of a property is whatever is output by Get-ObjectProperty -Raw plus an underscore at the end (unless the property is an inheritance property, which typically end in "group"). So the raw property of the name field is "name_", while location inheritance is just "locationgroup"

Regards,

lordmilko


Mar, 2018 - Permalink