cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1754
Views
10
Helpful
2
Replies

ISE ERS API import endpoints from xml or csv file

Madura Malwatte
Level 4
Level 4

First off I am warning everyone I am not a coder :)

I am playing around with ERS API to try and do a bulk import of mac addresses to an endpoint identity group.

I am using postman for now but I assume will probably need to convert to curl later once I get the syntax working through postman and everything is confirmed working fine.

I can successfully add an endpoint to an endpoint identity group by doing the following:

POST https://<ise-ip>:9060/ers/config/endpoint

Accept application/json

Content-Type application/json

{
"ERSEndPoint" : {
"name" : "Rebuild_Device",
"description" : "Device to be rebuilt",
"mac" : "00:01:02:03:04:05",
"groupId" : "2e23f7a0-5922-11e9-9392-9a776bb3096a",
"staticGroupAssignment" : true
}
}

Now I want to be able to create a csv or xml file with a list of all the mac addresses to be added to the endpoint identity group. What would my csv/xml file look like (I only care really about the mac addresses of the endpoint)? And how do I code the POST body to use the data in the xml/csv file?

2 Accepted Solutions

Accepted Solutions

Hi

Let me give you some idea on this.

You can use python for this operation.

Following will be the workflow.

1. Open the csv/txt file which contains mac address list & store the values as a variable (maclist)

2. Pass the ers credentials & header in variables.

3. Create a 'for' loop to iterate the mac address present in the text file.

4. Payload will be {"ERSEndPoint" : {"mac" : "mac", "groupId" : "2e23f7a0-5922-11e9-9392-9a776bb3096a", "staticGroupAssignment" : true}}

5. URL will be https://<ise-ip>:9060/ers/config/endpoint with post request.

6. Check the http status is 201 or not.

 

Example:

1. maclist = open('MAC.txt','r') #Open the sheet, read & store it under 'maclist' variable#

2. address = maclist.readlines() # Read the mac address list & store it in 'address' variable#

3. credentails = 'Pass the credentials' & create header with accept,authorization

4. for mac in address: # iterate the for loop for mac in range 'address' variable list #

             loginurl = 'https://<ise-ip>:9060/ers/config/endpoint'

             payload ={"ERSEndPoint" : {"mac" : "mac", "groupId" : "2e23f7a0-5922-11e9-9392-9a776bb3096a", "staticGroupAssignment" : true}}

             req = session.post(loginurl,json = payload,headers)

 

 

Note:Even am not a coder.

 

-Aravind

-Aravind

View solution in original post

Jason Kunst
Cisco Employee
Cisco Employee
You might want to see if they can help in devnet? Not so many coders here as well. This is not specific issue on cisco product but basic coding support

https://developer.cisco.com/site/security/

View solution in original post

2 Replies 2

Hi

Let me give you some idea on this.

You can use python for this operation.

Following will be the workflow.

1. Open the csv/txt file which contains mac address list & store the values as a variable (maclist)

2. Pass the ers credentials & header in variables.

3. Create a 'for' loop to iterate the mac address present in the text file.

4. Payload will be {"ERSEndPoint" : {"mac" : "mac", "groupId" : "2e23f7a0-5922-11e9-9392-9a776bb3096a", "staticGroupAssignment" : true}}

5. URL will be https://<ise-ip>:9060/ers/config/endpoint with post request.

6. Check the http status is 201 or not.

 

Example:

1. maclist = open('MAC.txt','r') #Open the sheet, read & store it under 'maclist' variable#

2. address = maclist.readlines() # Read the mac address list & store it in 'address' variable#

3. credentails = 'Pass the credentials' & create header with accept,authorization

4. for mac in address: # iterate the for loop for mac in range 'address' variable list #

             loginurl = 'https://<ise-ip>:9060/ers/config/endpoint'

             payload ={"ERSEndPoint" : {"mac" : "mac", "groupId" : "2e23f7a0-5922-11e9-9392-9a776bb3096a", "staticGroupAssignment" : true}}

             req = session.post(loginurl,json = payload,headers)

 

 

Note:Even am not a coder.

 

-Aravind

-Aravind

Jason Kunst
Cisco Employee
Cisco Employee
You might want to see if they can help in devnet? Not so many coders here as well. This is not specific issue on cisco product but basic coding support

https://developer.cisco.com/site/security/