Protected substituteProtected makeCustom API request
Allows making custom API requests to any UniFi Controller endpoint. This is useful for accessing endpoints that may not have dedicated methods or for testing new API functionality.
Required API path (must start with '/')
HTTP method (default: 'GET')
Optional payload: anyRequest payload for POST/PUT/PATCH requests
Expected return type format (default: 'array')
Site identifier (default: 'default')
Optional options: { Optional request configuration
Optional signal?: AbortSignalOptional AbortSignal to cancel the request
Promise resolving to the API response
When path doesn't start with '/'
When the API request fails
// GET request
const result = await utilityAPI.custom_api_request('/api/s/default/stat/device');
// POST request with payload
const result = await utilityAPI.custom_api_request(
'/api/s/default/cmd/stamgr',
'POST',
{ cmd: 'authorize-guest', mac: 'aa:bb:cc:dd:ee:ff', minutes: 60 }
);
// Custom endpoint with boolean return
const success = await utilityAPI.custom_api_request(
'/api/s/default/cmd/devmgr',
'POST',
{ cmd: 'restart', mac: 'aa:bb:cc:dd:ee:ff' },
'boolean'
);
UniFiClient.customApiRequest for the main client wrapper
PHP: custom_api_request($path, $method = 'GET', $payload = null, $return = 'array')
Substitutes site placeholder in URL