Ruckus VSZ-E API have some example or suggest?

  • 1
  • Question
  • Updated 5 months ago
  • In Progress
  • (Edited)
I want to make a program use Ruckus VSZ-E API on controller that can auto change guest-ssid password.
Have some example or suggest?
Photo of Wu Yen Yi

Wu Yen Yi

  • 6 Posts
  • 0 Reply Likes

Posted 2 years ago

  • 1
Photo of Michael Brado

Michael Brado, Official Rep

  • 3043 Posts
  • 432 Reply Likes
Please clarify what you mean by "change guest-ssid password".

Do you mean change the WPA2 passphrase needed to connect to the Guest Access WLAN you created,
or to Create Guest Pass for Users on this WLAN?

See vSZ-E 3.5.1 public API reference guide at this link:
http://docs.ruckuswireless.com/vscg-enterprise/vsz-e-public-api-reference-guide-3-5-1.html
(Edited)
Photo of Wu Yen Yi

Wu Yen Yi

  • 6 Posts
  • 0 Reply Likes
I want  change the WPA2 passphrase needed to connect to the Guest Access WLAN.
I Just want to make a program to change password every month.
I don't know how to make a api program. can you tell me how to make it and which program can  organization.

Thank you
Photo of Jeronimo

Jeronimo

  • 337 Posts
  • 40 Reply Likes
You may need a programer fot implementation.

If you want to test API, you can test using "Restlet Client - REST API Testing"

Get it on "https://chrome.google.com/webstore/detail/restlet-client-rest-api-t/aejoelaoggembcahagimdiliamlcdmfm"

It's very esay and free tool.

Regards.
(Edited)
Photo of James Miller

James Miller

  • 1 Post
  • 0 Reply Likes
Any update on this? I need to do a similar thing, and would love to start from a working example...
Photo of Tony Heung

Tony Heung, Official Rep

  • 11 Posts
  • 3 Reply Likes
Try this python executable script.

#!/usr/bin/env python

import csv, threading, requests

host = '<<SZ hostname>>'
adminname = '<<admin username>>'
adminpassword = '<<admin password>>'
zoneid = '<<Zone ID>>'
wlanid = '<<WLAN ID>>'
newwifikey = '<<New WPA2 Key>>'

def loginRuckus():
  import urllib3
  urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

  session = requests.session()
  urlsession = 'https://%s:8443/wsg/api/public/v8_0/session' % (host)

  response = session.post(urlsession, json={"username":adminname, "password":adminpassword }, verify=False)
  print(response.text)
  return session

def change_enc_key(session):
  url = 'https://%s:8443/wsg/api/public/v8_0/rkszones/%s/wlans/%s/encryption' % (host, zoneid, wlanid)
  response = session.patch(url, json={"method":"WPA2","passphrase":newwifikey},  verify=False)
  print(response.text)
  print(response)
  return

def main():
  change_enc_key(loginRuckus())
  return

if __name__ == '__main__':
  main()

(Edited)
Photo of Dave Watkins

Dave Watkins

  • 67 Posts
  • 13 Reply Likes
Because I've just spent _way_ to much time trying to do this in powershell, I figured I'd share a working powershell example

# Queries vSZ controllers using powershell
$UrlBase = "https://vsz:8443/wsg/api/public";
$apiVer = "v8_0"
$Body = [pscustomobject]@{ 
username = 'admin'
password = 'admin'
timeZoneUtcOffset = "+08:00"
}
$json = $Body | ConvertTo-Json
$session = Invoke-WebRequest -Uri $UrlBase/$apiVer/session -Method Post -Body $json -ContentType 'application/json' -SessionVariable websession
# Translate Cookie header into useable string
$stringCookie = [string]$session.Headers["Set-Cookie"]
$cookie = $stringCookie.substring(0,($stringCookie.length - 21))
# Add cookie to header
$headers = @{}
$headers.Add("Cookie",$cookie)
Invoke-RestMethod -Uri $UrlBase/$apiVer/session -Method GET -Headers $headers -ContentType 'application/json' -WebSession $websession
Invoke-RestMethod -Uri $UrlBase/apiInfo -Method GET -Headers $headers -ContentType 'application/json' -WebSession $websession