5 Replies Latest reply on Jan 8, 2018 9:21 AM by smttysmth02gt

    Python OrionSDK - search for custom properties that are empty

    lore.phoenix

      Hello,

       

      I am trying to get a list of nodes where the custom property is empty.
      With SQL we can use the expression 'IS NULL' but when using with the Orion API then we get the following message.

       

      requests.exceptions.HTTPError: 400 Client Error: Cannot resolve property ....

       

       

      from orionsdk import SwisClient
      
           # Init SWIS API
          npm_server = 'solarwinds.example.com'
          username = 'scripting'
          password = 'mysecretpassword'
      
           verify = False
           if not verify:
                from requests.packages.urllib3.exceptions import InsecureRequestWarning
                requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
      
           swis = SwisClient(npm_server, username, password)
      
           query = "SELECT NodeID, IP_Address, Caption FROM Orion.Nodes WHERE Country IS NULL"
           response = swis.query(query)

          

      I also tried it with Country LIKE '' or Country = '' but that didn't seems to work either.

       

      tdanner

      Is there a workaround  for this ?

      Kind regards