cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2840
Views
35
Helpful
6
Replies

ISE REST API : End Points with Bulk Get

rorourke1
Level 1
Level 1

ISE REST API v2.3

I've read over the API docs for both bulk operations and specifically End Points. The bulk info says I can send up to 5000 'id type' operations in one request. But it doesn't specifically say bulk get (by id) operations are supported. The example only discusses the create operation. Similarly, the End Point documentation has one example for bulk that only details create.

1) Do bulk operations work for get by id?

The docs for bulk End Point list a bare-bones JSON content. But even for the create operation it does not provide the necessary detail to follow through on this type of request using JSON.

2) Do bulk operations support JSON request content? If so, is there an example of this? Please, not a general "It's in <server>/ers/sdk". I need a specific location that documents a fully realized JSON request format. Otherwise, point me to a documented example of doing this sort of request.

I'm asking these because I have no problems sending a JSON request for non-bulk operations (particularly a create). But my create request doesn't explicitly set the content as JSON and is still correctly interpreted as it is. However, when I attempt to follow this line for a bulk request, the first obstacle I encounter is an error response stating "XML Schema Validation Failed :: at line 1, column 1 : Content is not allowed in prolog." Clearly the bulk request is somehow expecting XML. I'm not sure why bulk is doing this when other operations are not.

1 Accepted Solution

Accepted Solutions

hslai
Cisco Employee
Cisco Employee

Negative for both of your questions.

If the method supporting bulk, its summary table would have an entry for "Bulk Support"; e.g.

Method:PUT
......
Bulk Support:Operation 'DeRegister' can be used within Bulk Request.

 

And, the bulk requests are available in XML only in our current shipping ISE releases.

View solution in original post

6 Replies 6

hslai
Cisco Employee
Cisco Employee

Negative for both of your questions.

If the method supporting bulk, its summary table would have an entry for "Bulk Support"; e.g.

Method:PUT
......
Bulk Support:Operation 'DeRegister' can be used within Bulk Request.

 

And, the bulk requests are available in XML only in our current shipping ISE releases.

orp
Level 1
Level 1

As the OP stated it's not clear from the API docs whether json is supported or not. Actually, in ISE 2.4 docs the example payload does have json example, but only half an example with no explanation whatsoever as to why it looks like that.

Did something change in the latest ISE versions or json is still not supported?

@orp AFAIK JSON is supported.  I am able to run an endpoint bulk add script against ISE 2.4p9 successfully with JSON payload.  HTH!

Thanks for responding.

 

That's surprising. Can you please add a sample of the payload? The API doesn't show an example of the entire thing so I don't even know what are the names of the objects.

Maybe it's something that was added in patch 9?

 

This is what I'm seeing on my ISE:

 

You JSON payload would need to be similar to payloads you would use when simply adding or manipulating a single device.  Here is a snippet for bulk add of NEW MACs:

 

maclist = open('MAC.txt','r')
address = maclist.readlines()
for mac in address:
API_DEVICE = "https://<ISE NODE>:9060/ers/config/endpoint/"
API_ERS_USER = "<user>","<pass>"
API_DATA = ({
"ERSEndPoint" : {
"name" : "SDA Workstation",
"mac" : mac,
"staticGroupAssignment" : "true",
"groupId" : "a1649530-6840-11e9-aa97-0242f38bcc8a",
}
})
r = requests.post(url=API_DEVICE, auth=API_ERS_USER, verify=True, json=API_DATA)

 If you needed to update/manipulate a client that is not new it would take a bit more work as you would need to get each unique deviceID, return it, and extract it to then update it in the ISE DB.  A brief snippet:

if HOST == "False":
r = p_APIold(HW_ADDR)
print r.encoding
data = r.text
#Store response unicode file contents as string so we can extract each unique ID
hostIDJSON = json.loads(data)
for client in hostIDJSON['SearchResult']['resources']:
temp = client['id']
print temp
#Execute another function to update
p_APIupdate(temp)

 HTH!

Definitely. Thanks a lot ^_^