Skip to content

.NET Standard wrapper library for the Ubiquiti Unifi Controller

License

Notifications You must be signed in to change notification settings

schwoi/UnifiClient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UniFi Controller API client class

A .NET Standard library that provides access to Ubiquiti's UniFi Controller API, versions 4.X.X and 5.X.X of the UniFi Controller software are supported.

Wrapper Usage

//get all clients on the default site
using (var unifiClient = new Client("https://demo.ubnt.com/"))
{
    await unifiClient.LoginAsync("superuser", "password");
    var result = await unifiClient.ListAllClientsAsync();
}

//get all clients on the default site ignoring invalid certifiate
using (var unifiClient = new Client("https://localhost:8443/", null, true))
{
    await unifiClient.LoginAsync("superuser", "password");
    var result = await unifiClient.ListAllClientsAsync();
}

//get change site
using (var unifiClient = new Client("https://localhost:8443/", null, true))
{
    await unifiClient.LoginAsync("superuser", "password");
    var siteList = await unifiClient.ListSitesAsync();

	unifiClient.Site = result.siteList.FirstOrDefault(x => x.Name != "default")?.Name;
	
	var result = await unifiClient.ListAllClientsAsync();
}

//get all clients by setting the site in the call
using (var unifiClient = new Client("https://localhost:8443/", null, true))
{
    await unifiClient.LoginAsync("superuser", "password");
    var siteList = await unifiClient.ListSitesAsync();

	foreach(var site in result.siteList)
	{
		var result = await unifiClient.ListAllClientsAsync(site.Name);
	}
}

//Set site on connection
using (var unifiClient = new Client("https://localhost:8443/", "abc123", true))
{
}

Methods and functions supported

Currently this library supports the following methods.

  • Login
  • Logout
  • GetControllerStatus
  • ListCountryCodes
  • GetSystemInfo
  • ListSites
  • ListSiteAdmins
  • ListSitesStats
  • ListSiteSettings
  • ListAllAdmins
  • CreateSite
  • RenameSite
  • SetSiteCountry
  • SetSiteLocale
  • SetSiteSnmp
  • SetSiteManagement
  • SetSiteGuestAccess
  • SetSiteNtp
  • SetSiteConnectivity
  • DeleteSite
  • AuthorizeGuest
  • UnauthorizeGuest
  • ExtendGuest
  • ListGuests
  • ClientDetail
  • BlockClient
  • ForgetClient (Alias of ForgetClients)
  • ForgetClients
  • UnblockClient
  • ResetClientConnection
  • ShowClientLogins
  • ListOnlineClients
  • ListAllClients
  • ListKnownClients
  • AddClientNote (Alias of SetClientNote)
  • RemoveClientNote (Alias of SetClientNote)
  • SetClientNote
  • CreateUserGroup
  • DeleteUserGroup
  • UpdateUserGroup
  • AssignClientToUserGroup
  • ListUserGroups
  • CreateFirewallGroup
  • UpdateFirewallGroup
  • DeleteFirewallGroup
  • ListFirewallGroups
  • ListDevices
  • ListDeviceTags
  • ListRougeAp
  • ListKnownRougeAp
  • AdoptDevice
  • RestartDevice
  • RenameDevice
  • DisableAp
  • OverrideLed
  • LocateDevice
  • SiteLeds
  • ListBackups
  • CreateVoucher
  • RevokeVoucher
  • ListVouchers
  • ListWLans
  • CreateWLan
  • DeleteWLan
  • DisableWLan
  • EnableWLan
  • ChangeWLanSSID
  • ChangeWLanPassphrase
  • ListNetworks

Install

Nuget: https://www.nuget.org/packages/UnifiApi/

Install-Package UnifiApi

Requirements

Newtonsoft.Json

Credits

This class is based on the work done by the following developers:

About

.NET Standard wrapper library for the Ubiquiti Unifi Controller

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages