From 9cbcb6095083330d354a5b3822cb915b3e6eac7d Mon Sep 17 00:00:00 2001 From: malle-pietje Date: Fri, 12 May 2017 18:01:14 +0200 Subject: [PATCH] API Browser version 1.0.15, API client class version 1.1.4 - API client class: added methods/functions upgrade_device(), upgrade_device_external(), spectrum_scan() and spectrum_scan_state() - API browser tool: embedded the favicon in base64 encoded format - API browser tool: added a dynamic "back to top" butoon - examples: added examples ap_scanning_state.php and auth_guest_basic.php --- examples/ap_scanning_state.php | 35 +++++++++++ examples/auth_guest_basic.php | 48 +++++++++++++++ examples/auth_guest_with_note.php | 4 +- examples/list_alarms.php | 2 +- examples/list_site_health.php | 2 +- examples/list_social_auth_details.php | 2 +- favicon.ico | Bin 1150 -> 0 bytes index.php | 51 ++++++++++++++-- phpapi/class.unifi.php | 83 +++++++++++++++++++++++--- 9 files changed, 209 insertions(+), 18 deletions(-) create mode 100644 examples/ap_scanning_state.php create mode 100644 examples/auth_guest_basic.php delete mode 100644 favicon.ico diff --git a/examples/ap_scanning_state.php b/examples/ap_scanning_state.php new file mode 100644 index 0000000..c97e51c --- /dev/null +++ b/examples/ap_scanning_state.php @@ -0,0 +1,35 @@ +'; +$ap_mac = ''; + +/** + * load the Unifi API connection class and log in to the controller and do our thing + * spectrum_scan_state() + */ +require_once('phpapi/class.unifi.php'); +$unifidata = new unifiapi($controlleruser, $controllerpassword, $controllerurl, $site_id, $controllerversion); +$loginresults = $unifidata->login(); +$data = $unifidata->spectrum_scan_state($ap_mac); + +/** + * provide feedback in json format + */ +echo json_encode($data, JSON_PRETTY_PRINT); \ No newline at end of file diff --git a/examples/auth_guest_basic.php b/examples/auth_guest_basic.php new file mode 100644 index 0000000..7b97398 --- /dev/null +++ b/examples/auth_guest_basic.php @@ -0,0 +1,48 @@ +'; + +/** + * the duration to authorize the device for in minutes + */ +$duration = 2000; + +/** + * The site to authorize the device with + */ +$site_id = ''; + +/** + * load the Unifi API connection class and log in to the controller + */ +require_once('../phpapi/class.unifi.php'); +$unifidata = new unifiapi($controlleruser, $controllerpassword, $controllerurl, $site_id, $controllerversion); +$set_debug_mode = $unifidata->set_debug($debug); +$loginresults = $unifidata->login(); + +/** + * then we authorize the device for the requested duration + */ +$auth_result = $unifidata->authorize_guest($mac, $duration); + +/** + * provide feedback in json format + */ +echo json_encode($auth_result, JSON_PRETTY_PRINT); \ No newline at end of file diff --git a/examples/auth_guest_with_note.php b/examples/auth_guest_with_note.php index d26f523..cbfc55d 100644 --- a/examples/auth_guest_with_note.php +++ b/examples/auth_guest_with_note.php @@ -3,11 +3,11 @@ * PHP API usage example * * contributed by: slooffmaster - * description: example basic PHP script to auth a guest device and attach a note to it + * description: example basic PHP script to auth a guest device and attach a note to it, this method would normally be used for offline authorization only! */ /** - * include the config file (place you credentials etc. there if not already present) + * include the config file (place your credentials etc. there if not already present) * * NOTE: * this example will only work out of the box with a single controller config file! diff --git a/examples/list_alarms.php b/examples/list_alarms.php index ef251bb..baf9c70 100644 --- a/examples/list_alarms.php +++ b/examples/list_alarms.php @@ -7,7 +7,7 @@ */ /** - * include the config file (place you credentials etc. there if not already present) + * include the config file (place your credentials etc. there if not already present) * * NOTE: * this example will only work out of the box with a single controller config file! diff --git a/examples/list_site_health.php b/examples/list_site_health.php index 1926155..f8c1912 100644 --- a/examples/list_site_health.php +++ b/examples/list_site_health.php @@ -8,7 +8,7 @@ */ /** - * include the config file (place you credentials etc. there if not already present) + * include the config file (place your credentials etc. there if not already present) * * NOTE: * this example will only work out of the box with a single controller config file! diff --git a/examples/list_social_auth_details.php b/examples/list_social_auth_details.php index 320b12e..8c3037a 100644 --- a/examples/list_social_auth_details.php +++ b/examples/list_social_auth_details.php @@ -8,7 +8,7 @@ */ /** - * include the config file (place you credentials etc. there if not already present) + * include the config file (place your credentials etc. there if not already present) * * NOTE: * this example will only work out of the box with a single controller config file! diff --git a/favicon.ico b/favicon.ico deleted file mode 100644 index 2c1c01db3c11ddf80ca681d72a8d207149d1df8d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1150 zcmbVMOKVe65I$*ARO+HAxKI&y7TpT2d@OXKzd~HO(1o~jBW_$2H!502PsaQiG8WHKe)b6JyV&n{Tx?5pZS5ZE{C^ z&o$O=i>@LU-!UE5*h2Iqa19sYxVm3Cc1H}A*r>dPvD~BV^gik|vf^`Wi)w3QRD5}y z3Uf!P{P7BPO@p{syz21@N<84645GH~Z}r=4@$puAe}NMB72bt@KoVn$a*+}0wu%yC z8gE@bTyDUNRf~(Sm0ys1Wu73n%SC2tyW}V@U6mL-l5*&&#|!XI*A(Bzm+LM*pgCdA znHO-FpF5`U*o}p=x_4XyF}76~Uu6Y-!F))4#tPmq_(JrQhcCW5-G|>QeG;Fw8N=JQ z5zi0j=n40ux_Vb)Y^zG^GY4dbWv)=;_lL_~?s`0g9C}WZL1@fe>D_s>Uvt;YMBLh# z$=)3iZx$B499CtODl0c>x)_xOOgbxUV+n;QRi3wi|QyTIX=Nb`PSu<}WHl uPyAh5dgMb6mO&~nU7~h*88kI<=Qeff8RA*ZPVepOnRj>Kd*6Zo)qeo?@( + - + + + + + @@ -755,7 +768,9 @@ function sites_sort($a, $b)
  • United
  • Yeti
  • -
  • Reset PHP session
  • +
  • + Reset PHP session +
  • About UniFi API browser
  • @@ -817,6 +832,9 @@ function sites_sort($a, $b) + + +