ā11-15-2022 02:30 PM
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)
Solved! Go to Solution.
ā11-16-2022 02:26 PM
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
ā11-16-2022 02:26 PM
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
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