Can't set snmp community via REST API Python

Hello,

This is the code:

json={

    'folder': '/',
    'host_name': 'test_host',
    'attributes': {
        'ipaddress': '10.42.0.29',
        'tag_agent': 'no-agent',
        'tag_snmp_ds': 'snmp-v2',
        'snmp_community': 'Community',

    }

},

)

This is the error I got:

RuntimeError: {‘detail’: ‘These fields have problems: attributes’,
‘fields’: {‘attributes’: {‘snmp_community’: {’_schema’: 'Invalid data type: ’
‘Community’}}},
‘status’: 400,
‘title’: ‘Bad Request’}

I have tried to do show_host to another host to check the syntax and it looks ok.
Output from another host

show_host.py
{‘domainType’: ‘host_config’,
‘extensions’: {‘attributes’: {‘snmp_community’: ‘Community’,
‘tag_agent’: ‘no-agent’,
‘tag_snmp_ds’: ‘snmp-v2’},
‘cluster_nodes’: None,
‘is_cluster’: False,

Can anyone help me to understand why this happens? It is a syntax issue?
Thanks

Hi,

single quotes are not valid json, since the syntax requires double quotes.
Please try to replace all ’ with ".

Cheers
Jeronimo.

Same bahaviour… it doesn’t work

This only happends with the snmp_community value. If I remove that from the code it works perfectly.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.