cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 
cancel
1453
Views
0
Helpful
1
Replies

ISE Open API Example with Python

fitzie
Level 1
Level 1

I'm looking for a simple example of a GET in Python for the new Open API  (similar to those available with the ERS API).

Example: I can paste the following into a browser, and it works just fine:

https://<ISE_SERVER>/api/v1/policy/network-access/policy-set

I can also get this same request to work via Postman, with Basic Authentication.

When I attempt to do this via Python, I typically get a 404 error

 

import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
from requests.auth import HTTPBasicAuth
import urllib3
urllib3.disable_warnings()
basic = HTTPBasicAuth(user,passwd)
url = 'https://' + host + '/api/v1/policy/network-admin/policy-set'
headers = {'content-type': 'application/json'}
fred = requests.get(url, auth=basic, headers=headers, verify=False)
print(fred)

 

 

1 Accepted Solution

Accepted Solutions

thomas
Cisco Employee
Cisco Employee

This is a simple typo problem:

url = 'https://' + host + '/api/v1/policy/network-admin/policy-set'  # 404 
url = 'https://' + host + '/api/v1/policy/network-access/policy-set' # 200 8-)

See ā–¶ ISE REST APIs Introduction @ 06:47 for HTTP Response Status Codes and their meanings for clues:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status

View solution in original post

1 Reply 1

thomas
Cisco Employee
Cisco Employee

This is a simple typo problem:

url = 'https://' + host + '/api/v1/policy/network-admin/policy-set'  # 404 
url = 'https://' + host + '/api/v1/policy/network-access/policy-set' # 200 8-)

See ā–¶ ISE REST APIs Introduction @ 06:47 for HTTP Response Status Codes and their meanings for clues:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status