Skip to content

Instantly share code, notes, and snippets.

@codyroche
Created January 22, 2021 04:13
Show Gist options
  • Save codyroche/62c82715bed6d4501eba866b4e4429c8 to your computer and use it in GitHub Desktop.
Save codyroche/62c82715bed6d4501eba866b4e4429c8 to your computer and use it in GitHub Desktop.
Cisco CDO API - Device Status Example
import requests
import json
headers = {"Authorization": "Bearer <BEARER_TOKEN_HERE>"}
query = """query {
devices(limit: 50, sortField: NAME, deviceType: [FIREPOWER, ASA, FTD]) {
metadata {
count
}
items {
softwareVersion
name
uid
isModel
conflictDetectionState
ipv4
deviceType
serial
configurationStatus
interfaces
connectivityState
highAvailability
specificDevice {
namespace
... on FtdSpecificDevice {
uid
}
... on AsaSpecificDevice {
uid
type
vpnId
}
... on MerakiSpecificDevice {
uid
type
}
... on AwsSpecificDevice {
vpcId
region
}
}
}
}
}"""
url = "https://edge.us.cdo.cisco.com/api/public"
r = requests.post(url, headers=headers, json={"query": query})
print(r.status_code)
print(r.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment