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 | 126
Part no.9036931-00 Rev AA February 2021
When sending JSON data, you must add two headers:
- Content-Type
- Accept
They both must be set to application/json.
In this example, you assign a network policy to a device. You know the serial number and the policy
name of this device, and the rest of the information is retrieved from the API.
import requests
import os
import sys
import json
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}
POLICY = "PolicyAPI"
PolicyID = 0
DeviceID = 0
SN = "1441N-41334"
assignPolicy = {"sns": ["1441N-41334"]}
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")










