1 Reply Latest reply on Mar 6, 2017 2:46 PM by odegoldsby@iiinfo.com

    SwisClient methods  (invoke, update)


      Are there any examples showing how to update tables?   I'm simply trying to push comments or notes inside the Orion.AlertObjects.AlertNotes field.  I see in that table a relationship with  (Orion.AlertActive) that has a verb 'AppendNote'  I can invoke.  If I have the syntax right:



      AppendNote  ( alertObjectIds(System.Int32[], note(System.String))


      I attempt in python:


      aliases = swis.invoke('Orion.AlertActive', 'AppendNote ', '6220','TEST')      #  I just hardcoded  alertObjectId that I know exists and  string I want to add




      But I get:


      Traceback (most recent call last):

        File "./check.py", line 67, in <module>

          aliases = swis.invoke('Orion.AlertActive', 'AppendNote ', '6220','TEST')

        File "C:\Python27\lib\site-packages\orionsdk\swisclient.py", line 29, in invoke

          "Invoke/{}/{}".format(entity, verb), args).json()

        File "C:\Python27\lib\site-packages\orionsdk\swisclient.py", line 59, in _req


        File "C:\Python27\lib\site-packages\requests\models.py", line 909, in raise_for_status

          raise HTTPError(http_error_msg, response=self)

      requests.exceptions.HTTPError: 400 Client Error: Verb Orion.AlertActive.AppendNote : Not found for url: https://solarwinds-orion:17778/SolarWinds/Info





      What am I missing??

        • Re: SwisClient methods  (invoke, update)

          UPDATE:  I resolved my issue as my syntax was incorrect.  I had an extra space in the verb name field and also did not make the AlertObjectID a python list:



          aliases = swis.invoke('Orion.AlertActive', 'AppendNote ', '6220','TEST')     <<  remove extra space in 'AppendNote'  and '6220' needs to be inside a python list




          CORRECT SYNTAX  for AppendNote verb or the one that worked for me:

                  SWIS.INVOKE (  'TABLENAME'  ,   'VERBNAME'  ,   PYTHON LIST[int],    'TEXT NOTES WHATEVER'   )  


          aliases = swis.invoke('Orion.AlertActive', 'AppendNote', value,'TEST')



          code snippet:


          value = alertd['AlertObjectID']




          value = []


          aliases = swis.invoke('Orion.AlertActive', 'AppendNote', value,'TEST')     << < AlertObjectID integer is now in python list