• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Rowell Dionicio

Get Techie With It

  • Home
  • About
  • Newsletter
  • Resources
    • Archives
    • Book List
    • YouTube
  • Learn
    • Wi-Fi 6E
    • CCNP Enterprise Core
    • DevNet Associate
    • PCNSA Certified
  • Blog
  • Contact
  • Show Search
Hide Search

Python – Basic API Access with Mist Wi-Fi

November 17, 2020 By Rowell Leave a Comment

The Mist access points were designed with API first. The information you’re able to retrieve from their API is quite impressive. It’s enough for you to build your own dashboard, if you dare to take that leap.

The Mist API architecture is simple. It starts with the REST API client, which in this example, is my computer running a script. That request is made via HTTPS to the Mist cloud and processed. In return, the Mist API sends a response.

https://www.mist.com/documentation/mist-api-architecture/

Here’s a simple script that makes a request for the WLANs I have enabled. I then print it out the result to screen.

import json
import requests

site_id = '<your-site-id>'
url = "https://api.mist.com/api/v1/sites/{}/wlans".format(site_id)

headers = {
  'Authorization': 'Token <your-token>'
}

response = requests.request("GET", url, headers=headers)
r = json.loads(response.text)

for wlans in r:
    wlan_name = wlans['ssid']
    wlan_enabled = str(wlans['enabled'])
    wlan_vlan = str(wlans['vlan_id'])
    print("SSID: " + wlan_name, "\t Enabled: " + wlan_enabled, "\t VLAN: " + wlan_vlan )

Here is the output:

% python3 get_wlans.py
SSID: D-NET  Enabled: True 	 VLAN: 2
SSID: CTS 	 Enabled: True 	 VLAN: 2

Share this:

  • Facebook
  • LinkedIn
  • Twitter

Related

Filed Under: Coding Tagged With: mist, python

About Rowell

Wi-Fi expert. Coffee addict ☕️. Tech nerd. Business owner.

Reader Interactions

Leave a Reply Cancel reply

Primary Sidebar

Recent Posts

  • 6 GHz Frame Captures with EtherScope nXG
  • Manage Cisco Catalyst in the (Meraki) Cloud
  • Q1 2022 Income Report
  • First Look at Ekahau AI Pro – Network Simulator
  • PAN-OS Configuration Management – PCNSA

Categories

  • bschool
  • Certifications
  • Coding
  • DevNet Associate
  • Events
  • Lab
  • Networking
  • Personal
  • Podcasting
  • Professional
  • Reviews
  • Security
  • Short Stories
  • Uncategorized
  • Wireless

Archives

  • June 2022
  • May 2022
  • January 2022
  • December 2021
  • November 2021
  • August 2021
  • July 2021
  • April 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • August 2019
  • June 2019
  • May 2019
  • April 2019
  • March 2019
  • February 2019
  • January 2019
  • November 2018
  • September 2018
  • August 2018

Copyright © 2022 · Written by Rowell Dionicio · You're awesome.

 

Loading Comments...