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 | 123
Part no.9036931-00 Rev AA February 2021
The clientId or deviceId optional parameters are unique IDs for each client or device. They are found
when listing the appropriate data, and when they are added to the endpoint, where they point to more
information.
6.2 Use Python with XIQ
After you have created all the tokens necessary to connect to XIQ, you can write a Python script to
interact with and provide information about your XIQ account.
The best practice is to create environment variables on your OS, so that you can share your code
without leaking secret information. This approach is described in chapter 2.3.5.
6.2.1 Use GET
The example below shows one way to format your headers and connect to XIQ using Python 3.x (3.7.7 in
this example) and the requests library.
import requests
import os
import sys
baseURL = "HTTPS://ie.extremecloudiq.com/"
clientSecret = os.environ.get('clientSecret')
clientId = os.environ.get('clientId')
redirectURI = 'HTTPS://foo.com'
authToken = os.environ.get('authToken')
ownerID = os.environ.get('ownerID')
requestHeaders = { 'X-AH-API-CLIENT-SECRET': clientSecret,
'X-AH-API-CLIENT-ID': clientId,
'X-AH-API-CLIENT-REDIRECT-URI': 'HTTPS://foo.com',
'Authorization': authToken
}
params = {'ownerId': ownerID}
try:
r = requests.get(baseURL + 'xapi/v1/monitor/devices', headers=requestHeaders, params=params)
if r.status_code != 200:
print("Connection failure! Unable to connect to API")
sys.exit(1)










