Extreme API with Python
Table Of Contents
- 1 Preface
- 2 Introduction
- 3 EXOS APIs
- 4 VOSS API
- 5 XMC API
- 6 ExtremeCloud IQ API
- 7 Extreme Campus Controller API
Extreme API with Python
Page | 132
Part no.9036931-00 Rev AA February 2021
}
params = {'ownerId': ownerID}
def restGet(url):
try:
r = requests.get(baseURL + url, headers=requestHeaders, params=params)
if r.status_code != 200:
print("Connection failure! Unable to connect to API")
print(r.content)
sys.exit(1)
except requests.exceptions.RequestException as e:
print("There was an error accessing XIQ API")
sys.exit(1)
return r.json()
data = restGet('xapi/v1/configuration/webhooks')
print(data)
The result should match your current configuration:
C:\Extreme API with Python> webhookget.py
{'data': [{'ownerId': 88999, 'application': 'WebhookTest', 'secret': 'test',
'url': 'HTTPS://webhook.site/5b8f683d-e2e5-4373-aea8-9149a762357d',
'messageType': 'LOCATION_AP_CENTRIC', 'createdAt': '2020-07-
03T07:22:46.230Z', 'id': 382247794480746}], 'pagination': {'offset': 0,
'countInPage': 1, 'totalCount': 1}}
Stop the webhook by adding the following code at the end of your previous example:
subID = 0
for webhook in data.get('data'):
if webhook.get('application') == "WebhookTest":
subID = webhook.get('id')
break
if subID:
r = requests.delete(baseURL + 'xapi/v1/configuration/webhooks/{}'.format(subID),
headers=requestHeaders, params=params)
print(r.status_code)
print(r.text)










