mirror of
https://github.com/Art-of-WiFi/UniFi-API-client.git
synced 2024-11-21 17:49:59 +01:00
- bumped version to class v1.1.80
- added generate_backup_site() method, contributed by @labo-jad
This commit is contained in:
parent
cbe89d913c
commit
67d318ca91
11
README.md
11
README.md
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
A PHP class that provides access to Ubiquiti's [**UniFi Network Controller**](https://unifi-network.ui.com/) API.
|
A PHP class that provides access to Ubiquiti's [**UniFi Network Controller**](https://unifi-network.ui.com/) API.
|
||||||
|
|
||||||
UniFi Network Controller software versions 4.X.X, 5.X.X, 6.X.X, and 7.X.X (version 7.0.23 has been confirmed to work)
|
UniFi Network Controller software versions 4.X.X, 5.X.X, 6.X.X, and 7.X.X (version 7.2.93 has been confirmed to work)
|
||||||
are supported as well as UniFi OS-based controllers. This class is used by our API browser tool which can be found
|
are supported as well as UniFi OS-based controllers. This class is used by our API browser tool which can be found
|
||||||
[here](https://github.com/Art-of-WiFi/UniFi-API-browser).
|
[here](https://github.com/Art-of-WiFi/UniFi-API-browser).
|
||||||
|
|
||||||
@ -27,8 +27,9 @@ Support for UniFi OS-based controllers has been added as of version 1.1.47:
|
|||||||
- UniFi Dream Router (UDR)
|
- UniFi Dream Router (UDR)
|
||||||
- UniFi Dream Machine (UDM)
|
- UniFi Dream Machine (UDM)
|
||||||
- UniFi Dream Machine Pro (UDM PRO)
|
- UniFi Dream Machine Pro (UDM PRO)
|
||||||
- Cloud Key Gen2 (UCK G2), firmware version 2.0.24 or higher
|
- UniFi Cloud Key Gen2 (UCK G2), firmware version 2.0.24 or higher
|
||||||
- Cloud Key Gen2 Plus (UCK G2 Plus), firmware version 2.0.24 or higher
|
- UniFi Cloud Key Gen2 Plus (UCK G2 Plus), firmware version 2.0.24 or higher
|
||||||
|
- UniFi Cloud Console, details [here](https://help.ui.com/hc/en-us/articles/4415364143511)
|
||||||
|
|
||||||
The class automatically detects UniFi OS-based controllers and adjusts URLs and several functions/methods accordingly.
|
The class automatically detects UniFi OS-based controllers and adjusts URLs and several functions/methods accordingly.
|
||||||
If your own code implements strict validation of the URL that is passed to the constructor, please adapt your
|
If your own code implements strict validation of the URL that is passed to the constructor, please adapt your
|
||||||
@ -183,6 +184,8 @@ more details on each of the functions/methods and their respective parameters.
|
|||||||
- edit_usergroup()
|
- edit_usergroup()
|
||||||
- extend_guest_validity()
|
- extend_guest_validity()
|
||||||
- forget_sta() (supported on controller version 5.9.X and higher)
|
- forget_sta() (supported on controller version 5.9.X and higher)
|
||||||
|
- generate_backup()
|
||||||
|
- generate_backup_site()
|
||||||
- invite_admin()
|
- invite_admin()
|
||||||
- led_override()
|
- led_override()
|
||||||
- list_admins()
|
- list_admins()
|
||||||
@ -352,7 +355,7 @@ This class is based on the initial work by the following developers:
|
|||||||
|
|
||||||
and the API as published by Ubiquiti:
|
and the API as published by Ubiquiti:
|
||||||
|
|
||||||
- https://dl.ui.com/unifi/7.0.23/unifi_sh_api
|
- https://dl.ui.com/unifi/7.0.25/unifi_sh_api
|
||||||
|
|
||||||
## Important Disclaimer
|
## Important Disclaimer
|
||||||
|
|
||||||
|
@ -8,6 +8,9 @@
|
|||||||
* usage: If the file is called via a web URL, it should be called like: update_switch_poe-mode.php?poe_mode=off
|
* usage: If the file is called via a web URL, it should be called like: update_switch_poe-mode.php?poe_mode=off
|
||||||
* If the file is called via the command line, it should be called like: php update_switch_poe-mode.php off
|
* If the file is called via the command line, it should be called like: php update_switch_poe-mode.php off
|
||||||
* The values can be "off" or "auto"
|
* The values can be "off" or "auto"
|
||||||
|
*
|
||||||
|
* IMPORTANT INFORMATION:
|
||||||
|
* This example no longer works with controller versions 7.1.X and higher. You now need to work with port profiles to enable POE on a switch port.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -91,4 +94,4 @@ if (!$update_device) {
|
|||||||
echo json_encode($error, JSON_PRETTY_PRINT);
|
echo json_encode($error, JSON_PRETTY_PRINT);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo json_encode($update_device, JSON_PRETTY_PRINT);
|
echo json_encode($update_device, JSON_PRETTY_PRINT);
|
||||||
|
@ -13,7 +13,7 @@ namespace UniFi_API;
|
|||||||
*
|
*
|
||||||
* @package UniFi_Controller_API_Client_Class
|
* @package UniFi_Controller_API_Client_Class
|
||||||
* @author Art of WiFi <info@artofwifi.net>
|
* @author Art of WiFi <info@artofwifi.net>
|
||||||
* @version Release: 1.1.79
|
* @version Release: 1.1.80
|
||||||
* @license This class is subject to the MIT license that is bundled with this package in the file LICENSE.md
|
* @license This class is subject to the MIT license that is bundled with this package in the file LICENSE.md
|
||||||
* @example This directory in the package repository contains a collection of examples:
|
* @example This directory in the package repository contains a collection of examples:
|
||||||
* https://github.com/Art-of-WiFi/UniFi-API-client/tree/master/examples
|
* https://github.com/Art-of-WiFi/UniFi-API-client/tree/master/examples
|
||||||
@ -26,7 +26,7 @@ class Client
|
|||||||
* NOTE:
|
* NOTE:
|
||||||
* do not modify the values here, instead use the constructor or the getter and setter functions/methods
|
* do not modify the values here, instead use the constructor or the getter and setter functions/methods
|
||||||
*/
|
*/
|
||||||
const CLASS_VERSION = '1.1.79';
|
const CLASS_VERSION = '1.1.80';
|
||||||
protected $baseurl = 'https://127.0.0.1:8443';
|
protected $baseurl = 'https://127.0.0.1:8443';
|
||||||
protected $user = '';
|
protected $user = '';
|
||||||
protected $password = '';
|
protected $password = '';
|
||||||
@ -424,8 +424,7 @@ class Client
|
|||||||
* Add/modify/remove a client-device note
|
* Add/modify/remove a client-device note
|
||||||
*
|
*
|
||||||
* @param string $user_id id of the client-device to be modified
|
* @param string $user_id id of the client-device to be modified
|
||||||
* @param string $note optional, note to be applied to the client-device, when empty or not set,
|
* @param string $note optional, note to be applied to the client-device
|
||||||
* the existing note for the client-device is removed and "noted" attribute set to false
|
|
||||||
* @return bool returns true upon success
|
* @return bool returns true upon success
|
||||||
*/
|
*/
|
||||||
public function set_sta_note($user_id, $note = '')
|
public function set_sta_note($user_id, $note = '')
|
||||||
@ -1448,10 +1447,9 @@ class Client
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate backup
|
* Generate a backup
|
||||||
*
|
*
|
||||||
* NOTES:
|
* NOTES: this is an experimental function, please do not use unless you know exactly what you're doing
|
||||||
* this is an experimental function, please do not use unless you know exactly what you're doing
|
|
||||||
*
|
*
|
||||||
* @return array|bool URL from where the backup file can be downloaded once generated, false upon failure
|
* @return array|bool URL from where the backup file can be downloaded once generated, false upon failure
|
||||||
*/
|
*/
|
||||||
@ -1472,6 +1470,20 @@ class Client
|
|||||||
return $this->fetch_results('/api/s/' . $this->site . '/cmd/backup', $payload);
|
return $this->fetch_results('/api/s/' . $this->site . '/cmd/backup', $payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a backup/export of the current site
|
||||||
|
*
|
||||||
|
* NOTES: this is an experimental function, please do not use unless you know exactly what you're doing
|
||||||
|
*
|
||||||
|
* @return array|bool URL from where the backup/export file can be downloaded once generated, false upon failure
|
||||||
|
*/
|
||||||
|
public function generate_backup_site()
|
||||||
|
{
|
||||||
|
$payload = ['cmd' => 'export-site'];
|
||||||
|
|
||||||
|
return $this->fetch_results('/api/s/' . $this->site . '/cmd/backup', $payload);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch sites
|
* Fetch sites
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user