unifi-php-api/examples
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
..
site_provisioning_example
ap_scanning_state.php API client class v1.1.81 2023-12-18 11:11:27 +01:00
ap_upgrade_firmware.php API client class v1.1.81 2023-12-18 11:11:27 +01:00
auth_guest_basic.php API client class v1.1.81 2023-12-18 11:11:27 +01:00
auth_guest_with_note.php API client class v1.1.81 2023-12-18 11:11:27 +01:00
block_list.php API client class v1.1.81 2023-12-18 11:11:27 +01:00
change_super_mgmt.php API client class v1.1.81 2023-12-18 11:11:27 +01:00
change_wlan_password.php API client class v1.1.81 2023-12-18 11:11:27 +01:00
config.template.php
create_site.php API client class v1.1.81 2023-12-18 11:11:27 +01:00
create_voucher.php API client class v1.1.81 2023-12-18 11:11:27 +01:00
delete_site.php API client class v1.1.81 2023-12-18 11:11:27 +01:00
disable_device.php API client class v1.1.81 2023-12-18 11:11:27 +01:00
disable_switch_port.php API client class v1.1.81 2023-12-18 11:11:27 +01:00
execute_custom_api_request.php API client class v1.1.81 2023-12-18 11:11:27 +01:00
extend_guest_auth.php API client class v1.1.81 2023-12-18 11:11:27 +01:00
list_alarms.php API client class v1.1.81 2023-12-18 11:11:27 +01:00
list_ap_connected_users.php API client class v1.1.81 2023-12-18 11:11:27 +01:00
list_connected_users.php API client class v1.1.81 2023-12-18 11:11:27 +01:00
list_site_health.php API client class v1.1.81 2023-12-18 11:11:27 +01:00
list_sites.php API client class v1.1.81 2023-12-18 11:11:27 +01:00
list_social_auth_details.php API client class v1.1.81 2023-12-18 11:11:27 +01:00
list_user_stats.php API client class v1.1.81 2023-12-18 11:11:27 +01:00
modify_smartpower_pdu_outlet.php API client class v1.1.81 2023-12-18 11:11:27 +01:00
README.md
reconnect_client.php API client class v1.1.81 2023-12-18 11:11:27 +01:00
set_vlan_to_port.php API client class v1.1.81 2023-12-18 11:11:27 +01:00
test_connection.php API client class v1.1.73 2021-10-23 11:14:25 +02:00
toggle_led.php API client class v1.1.81 2023-12-18 11:11:27 +01:00
unblock_list.php API client class v1.1.81 2023-12-18 11:11:27 +01:00
update_ac-iw_ports.php API client class v1.1.81 2023-12-18 11:11:27 +01:00
update_device_wlan_settings_5.5.X.php API client class v1.1.81 2023-12-18 11:11:27 +01:00
update_switch_poe-mode.php API client class v1.1.81 2023-12-18 11:11:27 +01:00

API client class usage examples

This directory contains some PHP code examples which demonstrate usage of the PHP API client class and can be used as a good starting point for your own custom code.

Usage

Copy the appropriate example file to your working directory together with a copy of the config.template.php file which should be renamed to config.php. Then update the contents of your new config.php with your controller details and credentials and modify the example file as required to fit your needs.

Also make sure to update the path for the composer autoloader file (vendor/autoload.php) or the file containing the Class itself (src/Client.php) in your require_once() statement as required.

Executing scripts from the CLI

Most of the included example scripts can be run from the CLI or shell as follows after the necessary credentials and parameters have been added or updated:

$ php list_site_health.php

NOTE: this does require the php-cli module to be installed

Contribute

If you would like to share your own example file(s), please open an issue and include your code there or else create a pull request.

Important Disclaimer

Use these examples at your own risk!