06-29-2017 10:05 PM
I am trying to create an Endpoint and assign it to a static group with ERS. I have it working fine with XML:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns3:endpoint xmlns:ns2="ers.ise.cisco.com" xmlns:ns3="identity.ers.ise.cisco.com">
<groupId>cabb7fc0-5d4d-11e7-b01c-024226b23b4f</groupId>
<identityStore></identityStore>
<identityStoreId></identityStoreId>
<mac>11:22:33:44:55:66</mac>
<portalUser></portalUser>
<profileId>aa0e8b20-8bff-11e6-996c-525400b48521</profileId>
<staticGroupAssignment>true</staticGroupAssignment>
<staticProfileAssignment>false</staticProfileAssignment>
</ns3:endpoint>
I am trying to get it to work with JSON. I thought I would just need to specify the same parameters as I did with XML:
{
"ERSEndPoint" : {
"groupId" : "cabb7fc0-5d4d-11e7-b01c-024226b23b4f",
"identityStore" : "",
"identityStoreId" : "",
"mac" : "11:22:33:44:55:66",
"portalUser" : "",
"profileId" : "aa0e8b20-8bff-11e6-996c-525400b48521",
"staticGroupAssignment" : true,
"staticProfileAssignment" : false,
}
}
I am getting an error at the second to last bracket close and ISE says:
Invalid JSON Input: Unexpected character ('}' (code 125)): was expecting double-quote to start field name\n at [Source: java.io.StringReader@7c32de53; line: 11, column: 4]",
Does JSON require all the fields to be present?
Thanks.
Solved! Go to Solution.
07-06-2017 02:19 PM
You have an extra "," (comma) character ending the line:
"staticProfileAssignment" : false,
Removing it should help.
06-30-2017 07:25 AM
Paul,
Just yesterday I was trying to update the endpoint for a static group using XML but I was getting some error. Dint know that ISE supports JSON as well.
Could you share your complete POST request for the working XML requests ?
06-30-2017 08:04 AM
I am initially mocking it up in Postman (if you aren’t using this for REST testing you should). Make sure you have your Content-Type and Accept headers set to either XML or JSON.
The body I am using is exactly what I posted in my original post.
I am working on writing a C++ executable that uses libcurl to make REST calls to ISE. I am working on a scenario for SCCM reimage processes where the customer could add my executable into the process and it would do the following:
1) Find the MAC address of the primary interface on the system (Windows only).
2) Look up the MAC address in ISE to see if it exists. If it exists grab the ID.
3) Look up the endpoint identity group specified in ISE to make sure it exists and grab the ID.
4) If the MAC address exists POST an update to ISE to statically assign the MAC address to the group ID found in #3.
5) If the MAC address doesn’t exist POST an creation to ISE to add in the MAC address and statically assign it to the group in #3.
I have my C++ code finished up through 3. So now I am going to work on coding the POST.
I haven’t coded in C++ for probably 15 years so I am hacking my way through it.
Paul Haferman
Office- 920.996.3011
Cell- 920.284.9250
06-30-2017 08:16 AM
Also make sure that you are using a PUT when updating the Endpoint and a POST when creating one.
Paul Haferman
Office- 920.996.3011
Cell- 920.284.9250
06-30-2017 09:35 AM
I myself am building an API on top of ISE APIs in python.
Managed to write lot of functions but just started working on updating Identity Group yesterday
06-30-2017 10:33 AM
Hi Utkarsh,
Thank you for the interest.
If your API is functional, tested and has good documentation on the purpose and how to use it, kindly share it in the community for others to benefit with caveats etc.
Python is widely used by a lot of people for writing API.
Thanks
Krishnan
06-30-2017 10:54 AM
I would have written mine in Python as well, but my program needs to be a self-contained DOS executable. I think you can do that with Python, but it is easier with C++ and I have worked with C++ more recently than I have with Python (which is never).
I got the PUT working with XML to update an endpoint:
sendData = ":9060/ers/config/endpoint/56b46ec0-5da2-11e7-b01c-024226b23b4f";
curl_easy_setopt(curl, CURLOPT_URL, curl_url.c_str());
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, curl_headers);
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, sendData.c_str());
curl_result = curl_easy_perform(curl);
So I have the update working with PUT now I just need to do a POST to create a new MAC address and assign it to the endpoint identity group.
Fun stuf!!
Paul Haferman
Office- 920.996.3011
Cell- 920.284.9250
06-30-2017 11:02 AM
Guys if you have some examples I can post to the pages I have as well
Please post separate examples as docs
Sent from my iPhone
06-30-2017 11:48 AM
Paul,
Were you able to make it work with Json ?
I just made it work with XML using REST client but in python JSON would make a better.
06-30-2017 01:10 PM
No I haven’t gotten JSON PUTs or POSTs to work yet. I am using JSON for all my GET functions. I can’t even get the syntax to work in Postman. I will play around with it more next week. I would also like to use JSON for everything, but as long as I have it working one way or another it doesn’t matter for the application I am writing.
Paul Haferman
Office- 920.996.3011
Cell- 920.284.9250
07-06-2017 02:19 PM
You have an extra "," (comma) character ending the line:
"staticProfileAssignment" : false,
Removing it should help.
07-06-2017 02:43 PM
Awesome that was it! I was able to do the update with Postman. Now I will have to change my code to use JSON. I was able to strip down the JSON to the bare minimum required to update the MAC with a static Identity Group:
To update an existing MAC make a PUT call to:
https://",
"staticGroupAssignment" : true
}
}
Thanks so much for pointing out that extra comma. I haven’t worked with JSON much. I never would have figured that out.
Paul Haferman
Office- 920.996.3011
Cell- 920.284.9250
07-06-2017 02:52 PM
I am glad that helped. Please note that bulk requests are supported with XML only at the moment.
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