04-25-2019 11:49 AM
Hi community all team, good afternoon!
We’re trying to access ISE 2.1 information through RestAPI but commands is not working.
We tried to use CURL in GNU/Linux:
We tried to use Firefox app as well
We tried CURL in Windows
We tried to use shell script
#!/bin/bash
###########################################################################
# get-all-users.sh #
# This script demonstrates how to use the ISE ERS GET Internal User API #
# by executing a curl Linux command. #
# #
# USAGE: #
# 'get-all-users.sh <username> <password> <ise-ip-address>' #
# #
# SECURITY WARNING - DO NOT USE THIS SCRIPT IN PRODUCTION! #
# The curl -k switch allows connections to SSL sites without trusting #
# the server certificates. #
# For production, it is required to add certificate check. #
###########################################################################
if [ $# -ne 3 ]
then
echo "Missing Arguments, Expected: get-all-users.sh <username> <password> <ise-ip-address> "
exit
fi
echo "getting all internalusers from server: "$3" username: " $1
curl -v -k -X GET -H 'ACCEPT: application/vnd.com.cisco.ise.identity.internaluser.1.2+xml' \
'https://'$1':'$2'@'$3':9060/ers/config/internaluser'
But everything we try it’s not working.
We have enabled ERS.
At Windows OS with CURL:
C:\Users\xxxxxx\Desktop\curl-7.64.1-win64-mingw\bin>curl.exe -kv https://
ISE_IP:9060/ers/config/endpointgroup?filter=name.EQ.Work
station -H 'Accept:application/json' -u userapi:cisco
* Trying x.x.x.x...
* TCP_NODELAY set
* Connected to ISE_IP (x.x.x.x) port 9060 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: C=XX; ST=XX; L=XX; O=XXXX; OU=TI; CN=ISE_URL
* start date: Jul 15 11:44:30 2016 GMT
* expire date: Jul 15 11:54:30 2019 GMT
* issuer: DC=xx; DC=xxx; DC=xxxxxx; DC=xxxx; CN=XXXXXXXXXXXXX
* SSL certificate verify result: self signed certificate in certificate chain (
19), continuing anyway.
* Server auth using Basic with user 'userapi'
> GET /ers/config/endpointgroup?filter=name.EQ.Workstation HTTP/1.1
> Host: ISE_URL:9060
> Authorization: Basic anBhcGk6Y2lzY28=
> User-Agent: curl/7.64.1
> Accept: /
> 'Accept:application/json'
>
< HTTP/1.1 415 Unsupported Media Type
< Cache-Control: no-cache, no-store, must-revalidate
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< Set-Cookie: JSESSIONIDSSO=CD138825F7982C354C6E31B2E64DA14F; Path=/; Secure; Ht
tpOnly
< Set-Cookie: APPSESSIONID=D306FDBB888FBD9873CF444E7C684D06; Path=/ers/; Secure;
HttpOnly
< Pragma: no-cache
< Date: Thu, 11 Apr 2019 18:45:51 GMT
< Content-Type: application/vnd.com.cisco.ise.ers.ersresponse.1.1+xml;charset=ut
f-8
< Content-Length: 592
< Server:
<
<?xml version="1.0" encoding="utf-8" standalone="yes"?><ns3:ersResponse operatio
n="GET-getAll-endpointgroup" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:n
s3="ers.ise.cisco.com"><link rel="related" href="https://ISE_URL:9060/ers/config/endpointgroup?filter=name.EQ.Workstation" type="applicat
ion/xml"/><messages><message type="ERROR" code="Resource media type exception"><
title>The specified content-type is not supported. check the resource name in th
e request URI or the media type specified in the 'Accept' header.</title></messa
ge></messages></ns3:ersResponse>* Connection #0 to host ISE_URL left intact
* Closing connection 0
We can expect some help from TAC right now, thank you all community.
04-26-2019 03:43 AM
04-26-2019 10:17 AM
Hi dude, try first get some easy information and see if the basic it's working fine .
1. Install AdvancedRestClient in your Windows Machine
2. After installed in Authorization select basic and put the username and password (The user must be in ERS group)
3. Add a header with following parameter:
Header Name: Accept
Parameter value: application/vnd.com.cisco.ise.identity.internaluser.1.0+xml;charset=UTF-8
4. In the method select "Get" and put
"https://<ise-url>:9060/ers/config/internaluser/versioninfo"
5. Click "Send"
====================
Try also change the Header from:
C:\Users\xxxxxx\Desktop\curl-7.64.1-win64-mingw\bin>curl.exe -kv https://
ISE_IP:9060/ers/config/endpointgroup?filter=name.EQ.Work
station -H 'Accept:application/json' -u userapi:cisco
to:
C:\Users\xxxxxx\Desktop\curl-7.64.1-win64-mingw\bin>curl.exe -kv https://
ISE_IP:9060/ers/config/endpointgroup?filter=name.EQ.Work
station -H 'application/vnd.com.cisco.ise.identity.internaluser.1.0+xml;charset=UTF-8' -u userapi:cisco
Let's see if works.
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