Forum Discussion

Joe_Williams's avatar
6 years ago

Rest Filter Device Group not set property

We set a property on each customer folder to pass a code to our helpdesk software. If this property isn't set, a ticket can't be created.
So we put a default catch all property on the root folder. I am attempting to write a rest report so we can see which folders don't have the property set themselves.

 $queryParams = '?fields=customProperties,name,id&size=1000&sort=fullPath&filter=fullPath~Customers,customProperties.name:servicenow.companyid,customProperties.value:DefaultCODE';

My first attempt was match what folders have the default code applied to them. This didn't work, I am guessing because the property isn't truly applied to the folder as it is inherited. So how do I find folders that don't have the property directly applied to it?

2 Replies

Replies have been turned off for this discussion
  • Yup, customProperties object only has directly assigned props. 

    What you do what are the inheritedProperties for the /device/devices API endpoint--

     $queryParams = '?fields=inheritedProperties,name,id&size=1000&filter=inheritedProperties.name:servicenow.companyid,inheritedProperties.value:DefaultCODE';

     

    P.S. Thanks for bringing this up. I've been trying to find where the "aws.accountid" is grouped under and lo' and behold it's an inheritedProperty!

  • Well I got all excited, until I read your edit. :(

    I guess I will just do it the hard way, dump the base groups with their properties and use PHP to loop through.