This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

SwisClient methods (invoke, update)

FormerMember
FormerMember

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

print(aliases)

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

    resp.raise_for_status()

  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: solarwinds-orion:17778/.../Info

rmationService/v3/Json/Invoke/Orion.AlertActive/AppendNote%20

What am I missing??

  • FormerMember
    0 FormerMember

    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']

    to:

    value = []

    value.append(alertd['AlertObjectID'])

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