08-13-2015 05:09 PM - edited 03-01-2019 04:51 AM
Hi all,
I'm using python to write REST API calls to the APIC, version 1.0(3f), and I get inconsistent results. API inspector shows the payload and I POST the same payload but the results are 50% successful. Here's an example of a JSON payload in configuring a SNMP Trap Destination:
payload = {"snmpGroup":{"attributes":{"dn":"uni/fabric/snmpgroup-test_Solarwind","name":"test_Solarwind","descr":"test_Solarwind_desc","rn":"snmpgroup-test_Solarwind","status":"created"},"children":[{"snmpTrapDest":{"attributes":{"dn":"uni/fabric/snmpgroup-test_Solarwind/trapdest-10.1.1.220-port-162","host":"10.1.1.220","secName":"public","rn":"trapdest-10.1.1.220-port-162","status":"created"},"children":[{"fileRsARemoteHostToEpg":{"attributes":{"tDn":"uni/tn-mgmt/mgmtp-default/oob-default","status":"created"},"children":[]}}]}}]}}
The results come back as:
[fail]
{'imdata': [{'error': {'attributes': {'code': '822', 'text': "naming property ('snmpTrapDest.host') is not set."}}}]}
[success]
{'imdata': []}
I'm basically POST'ing over and over until I get a successful response. In the payload, I've even removed the empty 'children' array in the end and the results are the same.
Has anyone ran into this situation? Looks like I'm running into this problem only when I POST a json payload that has children arrays in it.
Thank you.
Solved! Go to Solution.