DNA API - Add Network-Device Troubleshooting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2022 11:52 AM
Hello,
I'm having trouble adding devices to DNA with the API. I've read the documentation (Cisco DevNet: APIs, SDKs, Sandbox, and Community for Cisco Developers), but can't tell what's wrong. When I try my python method I get this non descript error:
'errorCode': 'Bad request', 'message': 'Invalid input request', 'detail': 'There was an error processing the input arguments.'
Is there anywhere I can look to find a better error message? Here is my python method:
def add_dna_device(token, device): url = f'https://{server}/dna/intent/api/v1/network-device' headers = { "Content-Type": "application/json", "X-Auth-Token": f"{token}" } payload = { "type": "NETWORK_DEVICE", "cliTransport": "ssh2", "ipAddress": [ f"{device}" ], "snmpVersion": "2c", "snmpROCommunity": "test", "snmpRWCommunity": "test", "snmpRetry": 3, "snmpTimeout": 5, "userName": "test", "password": "test", "enablePassword": "test" } response = requests.post(url, headers=headers, data=payload, verify=False) return response.json()['response']
- Labels:
-
Cisco DNA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2022 10:01 AM
Hi @korey_oehlers,
I justing looking at your code in VS Code to debug. Is 'server' global or provided somewhere else in this file? It's not included in the parameters like 'token' and 'device' are.
Other than that, it looks good to me.
