products:software:unifi-controller:api

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
products:software:unifi-controller:api [2019/12/06 10:07]
henryguo [Table]
products:software:unifi-controller:api [2020/07/15 11:48] (current)
joestump Added notes about UDM Pro APIs
Line 15: Line 15:
 '​meta':​ {'​count':​ 4818, '​rc':​ '​ok'​} # from the api/​s/​{site}/​stat/​event endpoint '​meta':​ {'​count':​ 4818, '​rc':​ '​ok'​} # from the api/​s/​{site}/​stat/​event endpoint
 </​code>​ </​code>​
 +
 +==== UDM Pro API ====
 +
 +**NOTE:** There are two critical differences between Unifi controllers and the UDM Pro's API:
 +
 +  * The login endpoint is /​api/​auth/​login
 +  * All API endpoints need to be prefixed with /​proxy/​network
  
 ==== Controller Endpoints ==== ==== Controller Endpoints ====
Line 25: Line 32:
 { "​data"​ : [ ] , "​meta"​ : { "​rc"​ : "​ok"​ , "​server_version"​ : "​5.7.23"​ , "​up"​ : true , "​uuid"​ : "​0e727580-ffff-ffff-ffff-403dcd5a7bd4"​}} { "​data"​ : [ ] , "​meta"​ : { "​rc"​ : "​ok"​ , "​server_version"​ : "​5.7.23"​ , "​up"​ : true , "​uuid"​ : "​0e727580-ffff-ffff-ffff-403dcd5a7bd4"​}}
 </​code>​ ||| </​code>​ |||
-| api/login | POST | requires dict of username, password, and optionally remember=true for long-running sessions. ​ Returns 200 for success and a cooke that is your session |+| api/login | POST | requires dict of username, password, and optionally remember=true for long-running sessions. ​ Returns 200 for success and a cooke that is your session. **NOTE:** On UDM Pros this is api/​auth/​login. ​|
 | api/logout | GET | destroys the sever side session id which will make future attempts with that cookie fail | | api/logout | GET | destroys the sever side session id which will make future attempts with that cookie fail |
 | api/self | GET | Logged in user | | api/self | GET | Logged in user |
Line 111: Line 118:
 This data was extracted from the javascript of the site. This data was extracted from the javascript of the site.
  
-^ Device Code ^ Device Type ^ Device Name ^ +^ Device Code  ^ Device Type  ^ Device Name                  
-| BZ2 | uap | UniFi AP | +| BZ2          | uap          | UniFi AP                     ​
-| BZ2LR | uap | UniFi AP-LR | +| BZ2LR        | uap          | UniFi AP-LR                  
-| U2HSR | uap | UniFi AP-Outdoor+ | +| U2HSR        | uap          | UniFi AP-Outdoor+ ​           
-| U2IW | uap | UniFi AP-In Wall | +| U2IW         ​| uap          | UniFi AP-In Wall             ​
-| U2L48 | uap | UniFi AP-LR | +| U2L48        | uap          | UniFi AP-LR                  
-| U2Lv2 | uap | UniFi AP-LR v2 | +| U2Lv2        | uap          | UniFi AP-LR v2               ​
-| U2M | uap | UniFi AP-Mini | +| U2M          | uap          | UniFi AP-Mini ​               
-| U2O | uap | UniFi AP-Outdoor | +| U2O          | uap          | UniFi AP-Outdoor ​            ​
-| U2S48 | uap | UniFi AP | +| U2S48        | uap          | UniFi AP                     ​
-| U2Sv2 | uap | UniFi AP v2 | +| U2Sv2        | uap          | UniFi AP v2                  
-| U5O | uap | UniFi AP-Outdoor 5G | +| U5O          | uap          | UniFi AP-Outdoor 5G          
-| U7E | uap | UniFi AP-AC | +| U7E          | uap          | UniFi AP-AC                  
-| U7EDU | uap | UniFi AP-AC-EDU | +| U7EDU        | uap          | UniFi AP-AC-EDU ​             
-| U7Ev2 | uap | UniFi AP-AC v2 | +| U7Ev2        | uap          | UniFi AP-AC v2               ​
-| U7HD | uap | UniFi AP-HD | +| U7HD         ​| uap          | UniFi AP-HD                  
-| U7SHD | uap | UniFi AP-SHD | +| U7SHD        | uap          | UniFi AP-SHD ​                ​
-| U7NHD | uap | UniFi AP-nanoHD | +| U7NHD        | uap          | UniFi AP-nanoHD ​             | 
-| UCXG | uap | UniFi AP-XG | +| UFLHD        | uap          | UniFi AP-Flex-HD ​            | 
-| UXSDM | uap | UniFi AP-BaseStationXG | +| UHDIW        | uap          | UniFi AP-HD-In Wall          ​
-| UCMSH | uap | UniFi AP-MeshXG | +| UCXG         ​| uap          | UniFi AP-XG                  
-| U7IW | uap | UniFi AP-AC-In Wall | +| UXSDM        | uap          | UniFi AP-BaseStationXG ​      ​
-| U7IWP | uap | UniFi AP-AC-In Wall Pro | +| UCMSH        | uap          | UniFi AP-MeshXG ​             
-| U7MP | uap | UniFi AP-AC-Mesh-Pro | +| U7IW         ​| uap          | UniFi AP-AC-In Wall          
-| U7LR | uap | UniFi AP-AC-LR | +| U7IWP        | uap          | UniFi AP-AC-In Wall Pro      
-| U7LT | uap | UniFi AP-AC-Lite | +| U7MP         ​| uap          | UniFi AP-AC-Mesh-Pro ​        ​
-| U7O | uap | UniFi AP-AC Outdoor | +| U7LR         ​| uap          | UniFi AP-AC-LR ​              ​
-| U7P | uap | UniFi AP-Pro | +| U7LT         ​| uap          | UniFi AP-AC-Lite ​            ​
-| U7MSH | uap | UniFi AP-AC-Mesh | +| U7O          | uap          | UniFi AP-AC Outdoor ​         
-| U7PG2 | uap | UniFi AP-AC-Pro | +| U7P          | uap          | UniFi AP-Pro ​                ​
-| p2N | uap | PicoStation M2 | +| U7MSH        | uap          | UniFi AP-AC-Mesh ​            ​
-| US8 | usw | UniFi Switch 8 | +| U7PG2        | uap          | UniFi AP-AC-Pro ​             
-| US8P60 | usw | UniFi Switch 8 POE-60W | +| p2N          | uap          | PicoStation M2               | 
-| US8P150 | usw | UniFi Switch 8 POE-150W | +| US48PRO ​     | usw          | UniFi Switch Pro 48          ​
-| S28150 | usw | UniFi Switch 8 AT-150W | +| US8          | usw          | UniFi Switch 8               ​
-| USC8 | usw | UniFi Switch 8 | +| US8P60 ​      ​| usw          | UniFi Switch 8 POE-60W ​      ​
-| US16P150 | usw | UniFi Switch 16 POE-150W | +| US8P150 ​     | usw          | UniFi Switch 8 POE-150W ​     
-| S216150 | usw | UniFi Switch 16 AT-150W | +| S28150 ​      ​| usw          | UniFi Switch 8 AT-150W ​      ​
-| US24 | usw | UniFi Switch 24 | +| USC8         ​| usw          | UniFi Switch 8               ​
-| US24P250 | usw | UniFi Switch 24 POE-250W | +| US16P150 ​    ​| usw          | UniFi Switch 16 POE-150W ​    ​
-| US24PL2 | usw | UniFi Switch 24 L2 POE | +| S216150 ​     | usw          | UniFi Switch 16 AT-150W ​     
-| US24P500 | usw | UniFi Switch 24 POE-500W | +| US24         ​| usw          | UniFi Switch 24              
-| S224250 | usw | UniFi Switch 24 AT-250W | +| US24P250 ​    ​| usw          | UniFi Switch 24 POE-250W ​    ​
-| S224500 | usw | UniFi Switch 24 AT-500W | +| US24PL2 ​     | usw          | UniFi Switch 24 L2 POE       ​
-| US48 | usw | UniFi Switch 48 | +| US24P500 ​    ​| usw          | UniFi Switch 24 POE-500W ​    ​
-| US48P500 | usw | UniFi Switch 48 POE-500W | +| S224250 ​     | usw          | UniFi Switch 24 AT-250W ​     
-| US48PL2 | usw | UniFi Switch 48 L2 POE | +| S224500 ​     | usw          | UniFi Switch 24 AT-500W ​     
-| US48P750 | usw | UniFi Switch 48 POE-750W | +| US48         ​| usw          | UniFi Switch 48              
-| S248500 | usw | UniFi Switch 48 AT-500W | +| US48P500 ​    ​| usw          | UniFi Switch 48 POE-500W ​    ​
-| S248750 | usw | UniFi Switch 48 AT-750W | +| US48PL2 ​     | usw          | UniFi Switch 48 L2 POE       ​
-| US6XG150 | usw | UniFi Switch 6XG POE-150W | +| US48P750 ​    ​| usw          | UniFi Switch 48 POE-750W ​    ​
-| USXG | usw | UniFi Switch 16XG | +| S248500 ​     | usw          | UniFi Switch 48 AT-500W ​     
-| UGW3 | ugw | UniFi Security Gateway 3P | +| S248750 ​     | usw          | UniFi Switch 48 AT-750W ​     
-| UGW4 | ugw | UniFi Security Gateway 4P | +| US6XG150 ​    ​| usw          | UniFi Switch 6XG POE-150W ​   
-| UGWHD4 | ugw | UniFi Security Gateway HD | +| USXG         ​| usw          | UniFi Switch 16XG            
-| UGWXG | ugw | UniFi Security Gateway XG-8 | +| UGW3         ​| ugw          | UniFi Security Gateway 3P    
-| UP4 | uph | UniFi Phone-X | +| UGW4         ​| ugw          | UniFi Security Gateway 4P    
-| UP5 | uph | UniFi Phone | +| UGWHD4 ​      ​| ugw          | UniFi Security Gateway HD    
-| UP5t | uph | UniFi Phone-Pro | +| UGWXG        | ugw          | UniFi Security Gateway XG-8  
-| UP7 | uph | UniFi Phone-Executive | +| UP4          | uph          | UniFi Phone-X ​               
-| UP5c | uph | UniFi Phone | +| UP5          | uph          | UniFi Phone                  
-| UP5tc | uph | UniFi Phone-Pro | +| UP5t         ​| uph          | UniFi Phone-Pro ​             
-| UP7c | uph | UniFi Phone-Executive |+| UP7          | uph          | UniFi Phone-Executive ​       
 +| UP5c         ​| uph          | UniFi Phone                  
 +| UP5tc        | uph          | UniFi Phone-Pro ​             
 +| UP7c         ​| uph          | UniFi Phone-Executive ​       |
  
 ^ DPI Category Code ^ Name ^ ^ DPI Category Code ^ Name ^
Line 300: Line 310:
  
 </​code>​ </​code>​
 +
 +==== Update of Port Forward Rules ====
 +
 +This may apply to other configurations,​ but initial testing shows that port forward rules can be enabled/​disabled using PUT against the endpoint /​api/​s/​{site}/​rest/​portforward/​{rule-id} with a body such as:
 +<​code>​{
 +    "​enabled":​ true
 +}</​code>​
 +
 +The rule ID can be retrieved using the above described port forwarding GET request and is found in the "​_id"​ key.
 +
 +New rules can be created using POST, but be aware that there seems to be very little validation (it's possible to create entries with no information other than the fact that they'​re enabled, for example).
  • products/software/unifi-controller/api.1575644873.txt.gz
  • Last modified: 2019/12/06 10:07
  • by henryguo