Get LM DeviceGroup Properties REST API
I'm accessing the get device group properties api by using name in filters to get the hostgroupID.
I need a confirmation on get device group properties api. In the response output, is the first "items"(response['data']['tems'][0]) having an ID value is the devicegroupid ?
Is there any other way I can get the hostroupID by just the name or customerprefix of the deployment.
Vinusha
Posted 8 years ago·Last reply 4 years ago
6 comments
LM User
·4 years agoGotta be careful with this one. It searches for any group that has a custom property called "customer.name" and also has a custom property with a value of "customerA". It doesn't necessarily only return those where customer.name is "customerA".
For the negative, look at this page.
WhiskeyJ
·4 years agoHi Sarah
How would you get a list of of devices that do not have a custom property?
Thanks
David Bond
·4 years agoFeedback sent:
The REST API filtering system for various entities by custom properties, inherited properties and effective properties BADLY needs an overhaul.
There is no way to effectively filter by effective property.
API consumers simply want a list of (e.g.) Dashboard Groups with token defaultResourceGroup = "Customer A". They should not have to worry about whether that Group has the value applied directly or it is inherited.
I propose a set of NEW filter parameters, which should be consistently useable across all entities that support custom properties (or similar concepts):
The usual operators should be supported:
David Bond
·4 years ago@Sarah Terry,
Though what you say is (strictly) true, it is misleading. There is no way to filter a Device Group by the value of a specific custom property using the LogicMonitor API.
Your query does NOT mean:
It means:
Device Groups that have ANY custom property called "customer.name" and ANY custom property with value "customerA."
Let's say you have two Device Groups:
Your query would bring back both customers.
Vinusha
OP8 years agoSarah_Terry
·8 years agoHi Vinusha,
If you're trying to get device group id using the device group name, you can make a request like this:
And the 'id', first field in the items object (as you've noted) is the group id. You can restrict the fields returned in the response using the 'fields' query parameter as well.
You can also get device group id by filtering the request by property, like this:
This request will return the customProperties, name and id of groups that have a property customer.name set to customerA.
Does this help with what you're trying to do?
Thanks,
Sarah