3 releases
new 0.1.2 | Feb 6, 2025 |
---|---|
0.1.1 | Feb 6, 2025 |
0.1.0 | Feb 6, 2025 |
#2 in #door
344 downloads per month
23KB
409 lines
Unifi Access API Client
This is a basic handwritten wrapper for the Unifi Access API.
It is based on endpoints documented here: https://core-config-gfoz.uid.alpha.ui.com/configs/unifi-access/api_reference.pdf
For now it just has basic utilities that were useful for me.
lib.rs
:
Unifi Access API Client
This crate provides a client for the Unifi Access API based off of the documentation found here:
https://core-config-gfoz.uid.alpha.ui.com/configs/unifi-access/api_reference.pdf
This crate is a hand written wrapper of the described REST API, and is incomplete in coverage at the moment. This crate was developed to support a Makerspace door access system and is being happily used in production for that application.
Contributions to extend the functionality are welcome.
To get started login to your Unifi Controller and go to: Settings -> Security -> Advanced and create a new token. There is a link to the documentation for the API alongside the token.
The API is only available on the LAN network of the controller, if you want to access the API from offsite you'll need to establish a VPN.
A basic example:
use unifi_access::UnifiClient;
#[tokio::main]
async fn main() {
let client = UnifiClient::new("192.168.1.1", "your_auth_token");
let users = client.get_all_users().await.unwrap();
println!("{users:?}");
}
Head to [UnifiClient] to see the available operations.
The API is fully async and technically relies on tokio
, but tokio could be removed if folks want a different runtime.
Dependencies
~7–18MB
~233K SLoC