cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
264
Views
0
Helpful
4
Replies

ISE v3.2 patch 5 - API Network Device Group Creation

GtheGreat
Level 1
Level 1

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.

4 Replies 4

andrea80
Level 1
Level 1

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":

    • "Location#All Locations#AA" doesn't work
    • "Location:All Locations:AA" doesn't work
    • "All Locations#AA" doesn't work
    • "All Locations:AA" doesn't work
    • "AA" doesn't work

 

Many thanks for any help and suggestions!

thomas
Cisco Employee
Cisco Employee

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

 

 

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!

Hello Thomas

It works also with Python ... sooo many thanks again for the help!