04-04-2018 10:23 AM
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.
Solved! Go to Solution.
04-04-2018 11:01 AM
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.
04-04-2018 11:01 AM
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.
09-14-2020 03:00 AM
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?
09-15-2020 05:31 AM
@orp AFAIK JSON is supported. I am able to run an endpoint bulk add script against ISE 2.4p9 successfully with JSON payload. HTH!
09-16-2020 02:36 AM - edited 09-16-2020 02:41 AM
09-16-2020 05:34 AM
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!
09-30-2020 08:49 AM
Definitely. Thanks a lot ^_^
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