Commit Graph

79 Commits

Author SHA1 Message Date
malle-pietje
df1f70547c updated README
added announcement of minimum PHP version moving to 7.4
2023-12-18 12:32:03 +01:00
malle-pietje
d66c3ddd75 API client class v1.1.81
- hotfix to address cookie issues in UniFi OS 3.2.7, reported by @tflatebo
- fixed minor typos
- minor code reformatting of the examples
- starting with this release, cookies are no longer supported when connecting to a UniFi OS-based controller
- added set_vlan_to_port.php example, contributed by @SamuelSchnelly, #203
- allow additional parameters in `create_wlan()`'s payload, contributed by @sgrodzicki, #191
2023-12-18 11:11:27 +01:00
malle-pietje
67d318ca91 - bumped version to class v1.1.80
- added generate_backup_site() method, contributed by @labo-jad
2023-03-28 12:19:29 +02:00
malle-pietje
cbe89d913c API client class v1.1.79
- updated README to reflect support for 7.X
- `get_last_error_message()` now always returns a string which is empty if no message is available
- applied PR #151 in slightly different way for consistency with other similar code sections, contributed by @banakito
- changed default argument values in several methods/functions from null to an empty string
2022-03-28 11:57:57 +02:00
malle-pietje
aefbbdc5e1 API client class v1.1.75
- updated docblocks to be less USG-specific
- removed content-length header from the logout method, reported by @Olivier6767
- added notes to reflect successful tests with UDR running latest Pre-Release version of the UniFi controller (version 6.5.52)
- added checks in specific cases when using trim() to prevent PHP 8 from throwing an error when the variable is null, submitted by @djchen
2021-12-18 12:00:56 +01:00
malle-pietje
fbfd6a8246 API client class v1.1.74
- minor refactoring
- fixed minor typos
- updated README to reflect limited visibility when using read-only administrator accounts, reported by @KetchupBomb and @NickDunas
2021-11-08 10:30:22 +01:00
malle-pietje
310abc43b5 API client class v1.1.73
- minor spacing changes based on Scrutinizer feedback
- updated create_wlan() method/function to work with the new way of assigning a VLAN which now requires passing the _id value
of the VLAN, reported by @BeneReuthlinger
- merged #132, README update, contributed by @pauloboc
- merged #133, adds edit_client_name() method, contributed by @pauloboc
2021-10-23 11:14:25 +02:00
Paulo Ferreira
c3c44d61e4
Add method rename client (#133)
* Update Client.php

Add method rename client

* Update README.md
2021-10-23 10:34:39 +02:00
Paulo Ferreira
adb98a3c8e
Update README.md (#132)
Fix parameters separations
2021-10-22 17:35:05 +02:00
malle-pietje
9cca43557c API client class v1.1.72
- added property $request_timeout to control the cURL option CURLOPT_TIMEOUT, contributed by @mreho
- added setter and getter for $request_timeout, contributed by @mreho
- changed default value for the cURL option CURLOPT_HTTP_VERSION to CURL_HTTP_VERSION_1_1:
    - as of cURL version 7.62.0 the default value is CURL_HTTP_VERSION_2TLS which may cause issues
    - https://curl.se/libcurl/c/CURLOPT_HTTP_VERSION.html
- added property for $curl_http_version to hold the value for CURLOPT_HTTP_VERSION
- added setter and getter for $curl_http_version
- switched to using a constant to hold the class version
- updated the README file
2021-10-19 10:39:17 +02:00
malle-pietje
13b6699889 API client class v1.1.71
- modified `create_radius_account()` method to make Tunnel Type and Medium optional parameters, contributed by @mreho
- added `advanced_adopt_device()` method for more advanced adoption capabilities, contributed by @Sarrus
- refactored several code sections
- updated connection test script
2021-09-29 10:41:39 +02:00
malle-pietje
0e9ee66cef updated README to include new functions/methods 2021-01-23 11:44:12 +01:00
malle-pietje
721ba7d084 API client class v1.1.65
- applied minor improvements based on Scrutinizer reports
- applied minor changes to `authorize_guest()` to further improve handling of 0/null/empty values passed
- restricted protocols to be used by cURL to only allow http and https for improved security
- added methods/functions `list_device_name_mappings()` and `stat_full_status()`
2021-01-23 11:41:52 +01:00
malle-pietje
bf3446bba0 API client class v1.1.64
- added information to several docblocks
- changed handling of request headers, added private property for this
- applied changes for improved use of require_once in the README and examples
- added `list_sites()` example
- *potential breaking changes:*
    renamed `get_request_type()` and `set_request_type()` functions/methods to `get_request_method()` and `set_request_method()` respectively
2021-01-21 10:59:27 +01:00
malle-pietje
a4998de3a9 API client class v1.1.63
- changed references to *UbiOS* back to *UniFi OS*
- removed capitalization from all header strings (per RFC, header fields are case-insensitive: https://tools.ietf.org/html/rfc7230#section-3.2)
- removed charset parameter from headers (not required per RFC)
- added x-csrf-token header to all requests except GET when talking to UniFi OS-based controllers, thanks go to @paciks for raising #86
2021-01-06 17:03:21 +01:00
malle-pietje
c82481a28a API client class v1.1.62
- added several monthly stats methods: `stat_monthly_gateway()`, `stat_monthly_site()`, `stat_monthly_aps()`, `stat_monthly_user()`, thanks go to @Roel Janssens for spotting these MongoDB collections
- test for `object` or `resource` in `get_curl_resource()`, closes PR #82 submitted by @banakito
- applied change to comments in `example/modify_smartpower_pdu_outlet.php` based on a suggestion by @thesohoguy
- removed unnecessary variable from `list_apgroups()`, thanks go to Stephen Davies for reporting
- added an optional parameter $ap_group_ids to the `create_wlan()` function/method for UniFi controller versions 6.0.X and higher, thanks go to Stephen Davies for contributing
2020-12-10 14:52:39 +01:00
malle-pietje
2c743563f8 API client class v1.1.61
- minor improvements of comments contents
- fixed naming error in comments for list_devices()
- updated supported controller versions in main README
- change variable names used from MBytes to megabytes for improved consistency
2020-11-26 13:19:53 +01:00
malle-pietje
120699d343 API client class v1.1.59
- added methods/functions to manage AP groups: list_apgroups(), create_apgroup(), edit_apgroup(), and delete_apgroup() (only supported with controller versions 6.0.X and higher)
- adapted code to handle the behavior of the new v2 API routes that were added with controller versions 6.0.X and higher
- merged PR #76 which adds methods/functions check_controller_update() and check_firmware_update(), contributed  by @brenard
- further work on updating method/function comments to PHPDoc format (PSR-5)
2020-10-26 09:51:41 +01:00
malle-pietje
d26cba1f66 API client class v1.1.58
- changed several references from UniFi SDN controller to UniFi Network controller
- added optional payload parameter to the list_alarms() method/function, contributed by @MikeSiekkinen through PR #68
- added example showing how to disable/enable a UniFi switch port
- updated restart_device() function/method, thanks go to @leonardogyn for reporting this
- added example to modify outlet settings on a UniFi SmartPower PDU Pro, thanks go to @panthergm for providing access
2020-10-22 14:23:29 +02:00
malle-pietje
69b43df148 API client class v1.1.57
- increased minimum required PHP version to 5.5.0
- minor syntax improvement based on Scrutinizer feedback
- added create_dynamicdns() and set_dynamicdns() methods, "borrowed" routes from @smos
- added set_element_adoption() method, contributed by @VWT-Dan
- made a start at changing the function/method comments to PHPDoc format (PSR-5) which will support auto-generated class documentation (https://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc.md#5-the-phpdoc-format)
- added check to throw an error when the $baseurl ends with a / character, thanks to @infraweavers for submitting #66
- fixed issue with logout() on UDM PROs, thanks go to @Olivier6767 for providing access to a UDM PRO, addresses #63
- applied several code styling improvements
2020-08-22 17:47:50 +02:00
malle-pietje
2b34890a67 - minor syntax improvement based on Scrutinizer feedback
- added create_dynamicdns() and set_dynamicdns() methods, "borrowed" routes from @smos
- made a start at changing the function/method comments to PHPDoc format (PSR-5) which will support auto-generated class documentation
(https://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc.md#5-the-phpdoc-format)
2020-06-20 16:12:13 +02:00
malle-pietje
89ce2fd8dd - general code clean up
- removed repetitive code (checks using $this->is_loggedin())
- updated the main README to include the latest added functions/methods
2020-06-08 12:52:32 +02:00
malle-pietje
329ad595c9 API client class v1.1.53
- added list_routing() method/function, contributed by @VWT-Dan
- added list_firmware() method/function
- added get_class_version() method/function, returns the (semantic) version number of the Class
- cleaned up the class to remove repetitive code
- changed names of several protected functions for improved consistency
- general code clean up
- minor additions to the main README file
2020-06-07 14:11:52 +02:00
malle-pietje
49d0986bd7 API client class v1.1.51
- updated README with all getter and setter methods/functions
- updated get_cookies() and get_cookie() for consistency
- get_cookie() remains for backward compatibility only, should not be used in new code
- fix rare cases where the client would end up in a loop, e.g. issuing a request for a site the cached credentials have no
access to
2020-03-19 16:07:31 +01:00
malle-pietje
17d895076f API client class v1.1.47
- applied patches to update_switch_poe-mode.php as suggested by scrutinizer-ci.com
- code clean up and improvements in preparation of support for UniFi OS-based controllers
- added support for UniFi OS-based controllers, thanks to @Scyto for providing access
- adapt login route and method, and base URL for UniFi OS-based controllers
- automatically identify UniFi OS-based controllers, thanks to @TwitchCaptain for this and several other suggestions
- relaxed URL validation to allow UniFi OS-based controllers to pass
- changed default HTTP method to GET
- many improvements throughout the code
2020-02-06 08:52:49 +01:00
malle-pietje
a3fc0732e2 API client class v1.1.46
- applied patches to update_switch_poe-mode.php as suggested by scrutinizer-ci.com
- placed warning that UniFI OS is not (yet) supported
2020-01-31 12:14:52 +01:00
malle-pietje
2ac791a353 API client class v1.1.44
- added example script reconnect_client.php
- fixed typo in URL linking to UniFi section on the UI.com site
- add function/method reboot_cloudkey(), contributed by @leonardogyn
2020-01-27 13:19:49 +01:00
malle-pietje
b3521d8c1d updated main README to include the newly added functions/methods
added example to demonstrate the use of set_super_mgmt_settings_base()
2019-10-15 14:16:23 +02:00
malle-pietje
727cd6dc9c API client class v1.1.42
changed variable name $url to $path in custom_api_request() for consistency and clarity
rearranged layout of Client.php
added check to verify whether $ch is a resource
renamed get_curl_obj() to get_curl_resource() to reflect the variable type it returns

Added the new functions/methods:
* set_super_mgmt_settings_base()
* set_super_smtp_settings_base()
* set_super_identity_settings_base()
2019-10-15 14:04:37 +02:00
malle-pietje
09db47affd API client class v1.1.41
changed create_wlan function/method to not include passphrase in payload when security = "open" and passphrase = null
fixed indentations in several places
added custom_api_request() function/method which allows a programmer to issue custom API requests that may not yet be supported by this client (to be used with care!)
added example to demonstrate use of custom_api_request()
removed repetitive code and optimized exec_curl() when creating the final payload, resulting in 10-20% performance increase and slightly lower memory consumption by PHP
2019-04-29 17:35:09 +02:00
malle-pietje
55867197e3 fixed functions assign_existing_admin() and invite_admin() to support controller versions 5.9 and higher because of changes in controller behavior 2019-01-21 09:41:47 +01:00
malle-pietje
78bed0895d minor code tweaks for improved readability
added function/method assign_existing_admin()
fixed code for function/method invite_admin()
2019-01-19 15:17:53 +01:00
malle-pietje
77cc1d87a4 made regex to extract cookies case insensitive, though this would only be needed for corner cases this is still RFC compliant (https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2)
changed the layout of the README file to put more emphasis on the installation options and the basic example, and less on the list of methods/functions
2018-12-14 11:27:20 +01:00
malle-pietje
5389f3a486 API client class v1.1.37
updated both READMEs
added cmd_stat() function, can currently only be used to reset DPI counters for the current site
added optional group_id parameter to list_firewallgroups() which allows you to select a single firewall group, thanks to @VWT-Dan for the suggestion
2018-11-05 12:18:10 +01:00
malle-pietje
2a566ad18a API client class v1.1.36
added methods stat_ips_events(), set_ips_settings_base(), supported with controllers 5.9.10 and higher
thanks go to @leonardogyn for providing access to a controller and test network for test/validation purposes
2018-10-24 09:54:43 +02:00
malle-pietje
1714e9587c general code cleanup
added spaces throughout Client.php following PSR-2 guidelines that were skipped with the previous commit
added visibility to constructor and destructor methods following PSR-2 recommendations
declare user and password properties and visibility following PSR-2 recommendations
updated README to add recently added functions/methods
minor general changes to the README
2018-10-20 14:29:08 +02:00
malle-pietje
6f1b75b89a updated comments for stats-related methods/function to make clear start/end values must be provided in milliseconds
changed use of objects as payload input for json_encode, to associative arrays for consistency
added functions/methods for firewall groups: list_firewallgroups(), create_firewallgroup(), edit_firewallgroup(), delete_firewallgroup()
added checks for required boolean parameters
2018-08-19 12:00:19 +02:00
malle-pietje
871ab82608 added user/client device stats methods/functions:
stat_5minutes_user()
stat_hourly_user()
stat_daily_user()
added example to demonstrate use of these new functions
2018-07-02 15:06:31 +02:00
malle-pietje
4dddd08d8b added unblock_list.php and block_list.php examples, contributed by @malcolmcif
added create_user() method/function
added forget_sta() method/function which is supported on controller version 5.9.* and higher
2018-05-21 13:06:50 +02:00
malle-pietje
a238ced589 added methods/functions start_rolling_upgrade() and cancel_rolling_upgrade() 2018-04-10 15:24:12 +02:00
malle-pietje
bf9a6e801c added invite_admin() and revoke_admin() functions/methods 2018-03-30 13:57:59 +02:00
malle-pietje
d7827fdbf1 General code cleanup (replace tabs by spaces, etc.)
Finalised merge of PRs #10, #11, #12 and #13
Methods/functions added:
- list_country_codes()
- set_guestlogin_settings_base()
- set_site_connectivity()
- set_site_country()
- set_site_guest_access()
- set_site_locale()
- set_site_mgmt()
- set_site_name()
- set_site_ntp()
- set_site_snmp()
Examples added:
- ap_upgrade_firmware.php
- site_provisioning_example
- update_ac-iw_ports.php
2018-03-24 10:46:42 +01:00
malle-pietje
77972aab55 removed donation section from README (...) 2018-02-01 17:04:13 +01:00
malle-pietje
f6201ec21c minor changes
added an example to update WLAN settings for recent controllers (5.5.X and higher)
2018-02-01 16:56:17 +01:00
malle-pietje
cab0c1a35d Update README.md 2017-10-26 17:14:39 +02:00
malle-pietje
2b5ed31759 Update README.md 2017-10-26 17:12:51 +02:00
malle-pietje
c4bc1243eb - minor code cleanup and input validation/sanitization improvements
- added delete_device() function/method
- added move_device() function/method
- added optional `type` parameter to stat_sessions()
- updated README
2017-10-26 17:06:59 +02:00
malle-pietje
449baa70a3 updated README 2017-10-19 11:24:24 +02:00
malle-pietje
2dc5136eba minor code clean up
added archive_alarm() function/method
2017-10-19 11:20:33 +02:00
malle-pietje
e1f3cd6e73 updates to README 2017-10-18 10:09:55 +02:00