Extreme API with Python

Table Of Contents
Extreme API with Python
Page | 129
Part no.9036931-00 Rev AA February 2021
'X-AH-API-CLIENT-ID': clientId,
'X-AH-API-CLIENT-REDIRECT-URI': 'HTTPS://foo.com',
'Authorization': authToken,
'Accept': 'application/json',
'Content-type': 'application/json'
}
webhookurl = 'HTTPS://webhook.site/5b8f683d-e2e5-4373-aea8-9149a762357d'
params = {'ownerId': int(ownerID), 'application': 'WebhookTest', 'url': webhookurl, '
secret': 'test', 'messageType': 'LOCATION_AP_CENTRIC', 'eventType': 'LOCATION'}
params = json.dumps(params)
try:
r = requests.post(baseURL + 'xapi/v1/configuration/webhooks', headers=subscriptio
nHeaders, data=params)
if r.status_code != 200:
print("Connection failure! Unable to connect to API. error code: {}".format(r
.status_code))
sys.exit(1)
except requests.exceptions.RequestException as e:
print("There was an error accessing XIQ API")
sys.exit(1)
print(r.text)
After you execute this code, you should see the following result:
C:\Extreme API with Python> webhook.py
{"data":{"ownerId":88999,"application":"WebhookTest","secret":"test","url":"H
TTPS://webhook.site/5b8f683d-e2e5-4373-aea8-
9149a762357d","messageType":"LOCATION_AP_CENTRIC","createdAt":"2020-07-
03T07:22:46.230Z","id":382247794480746}}
If you connect to your XIQ account, you can see the webhook is configured from the Global Settings
menu, in the API Data Management panel.