10-10-2024 07:27 AM - edited 10-10-2024 07:28 AM
Hi all
We try to add network device groups to all Location with python
headers = {'content-type' : 'application/json', 'Accept':'application/jsson'}
payload="{
"NetworkDeviceGroup" : {
"name" : "Location#All Locations#AA",
"ngdtype" : "Location",
"description" : "Imported"
}
}"
rest_url = https://xxx.xxx.xxx.xxx:9060/ers/config/networkdevicegroup
requests.post(url=rest_url, auth=(ise_user, ise_password), headers=headers, verify=False, data = payload)
We always get the 400 Bad request error.
Thanks for helping.
10-11-2024 12:44 AM - edited 10-11-2024 01:12 AM
Hello,
I am working together with GtheGreat at this issue. I just would like to correct the API-Call and specify more details:
=> we are using ISE v3.2 with patch-level 5, ERS and Python:
headers = {'Content-Type' : 'application/json', 'Accept':'application/json'}
payload = {"NetworkDeviceGroup" : {"name" : "Location#All Locations#AA", "description" : "Imported", "ndgtype" : "Location"}}
rest_url = 'https://xxx.xxx.xxx.xxx:9060/ers/config/networkdevicegroup'
requests.post (url=rest_url, auth=(ise_user, ise_password), headers=headers, verify=False, data=payload)
Anyway we receive always the same http-error "400 - Bad request ". The problem is probably in the field called "name":
Many thanks for any help and suggestions!
10-11-2024 09:24 AM
You mispelled as ngd not ndg in your example above. ndgtype was a bug introduced for a while and should be fixed in all releases with latest patches. The correct attribute name to use is othername instead of ndgtype .
This worked for me on ISE 3.3 Patch 2:
curl --include --insecure --location \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--user $ISE_REST_USERNAME:$ISE_REST_PASSWORD \
--request POST https://$ISE_PPAN/ers/config/networkdevicegroup \
--data '
{
"NetworkDeviceGroup": {
"name": "Location#All Locations#AA",
"description": "...",
"othername": "Location"
}
}'
HTTP/1.1 201
Location: https://ise/ers/config/networkdevicegroup/718aad00-87ec-11ef-9c62-6ecbd13ff78e
Date: Fri, 11 Oct 2024 16:18:26 GMT
10-14-2024 07:59 AM
Hello Thomas
I am now able to create a new NDG using CURL. I will repeat the same test using Python A.S.A.P..
Thank you very much for the help!
10-14-2024 08:33 AM - edited 10-14-2024 08:33 AM
Hello Thomas
It works also with Python ... sooo many thanks again for the help!
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide