source-command-unifi-api-docs-update-2 ยท git:20260812.34020a0 ยท 2026-08-12 ยท sha256 85a719a911ac5344
source-command-unifi-api-docs-update-2 git:20260812.34020a0A
Immutable. This exact content never changes and is served at /api/v1/blob/85a719a911ac5344.
---
name: "source-command-unifi-api-docs-update-2"
description: "Update UNIFI_API.md with latest endpoints from developer.ui.com"
---
# source-command-unifi-api-docs-update-2
Use this skill when the user asks to run the migrated source command `unifi-api-docs-update 2`.
## Command Template
Scrape the latest UniFi API documentation from developer.ui.com and update docs/UNIFI_API.md with newly discovered endpoints.
This command runs the `scripts/update-api-docs.js` Puppeteer-based scraper to fetch API documentation from the official UniFi developer site and compare it against the current documentation.
**API Sources:**
- Site Manager API (v1.0.0): https://developer.ui.com/site-manager/v1.0.0/gettingstarted
- Network API (v10.1.68): https://developer.ui.com/network/v10.1.68/gettingstarted
- Protect API (v6.2.83): https://developer.ui.com/protect/v6.2.83/gettingstarted
**Steps to execute:**
1. Verify dependencies are installed:
```bash
npm list puppeteer
```
If not installed, run: `npm install puppeteer`
2. Run the API documentation updater:
```bash
node scripts/update-api-docs.js
```
3. Review the changes:
- Check how many new endpoints were discovered
- Verify the markdown formatting is correct
- Review the extracted examples and descriptions
4. Show summary:
```bash
git diff --stat docs/UNIFI_API.md
```
**What the script does:**
1. **Extracts endpoints** from each API source:
- Navigates to the getting started page
- Discovers all endpoint links from the sidebar
- Filters out non-API pages (getting started, guides, etc.)
2. **Compares with existing documentation**:
- Loads current docs/UNIFI_API.md
- Checks if each endpoint is already documented
- Identifies new endpoints to add
3. **Extracts detailed information** for new endpoints:
- HTTP method (GET, POST, PUT, PATCH, DELETE)
- Endpoint path
- Description
- Code examples (curl commands)
- Reference link to official docs
4. **Updates documentation**:
- Generates markdown sections for each API product
- Adds new endpoints with proper formatting
- Appends sections to existing documentation
- Preserves all existing content
**Expected output:**
```
๐ UniFi API Documentation Updater
Loading existing documentation...
โ Loaded (42243 characters)
Processing Site Manager v1.0.0...
Loading https://developer.ui.com/site-manager/v1.0.0/gettingstarted...
โ Found 11 endpoints
โ 4 new endpoints found
Extracting: Query ISP Metrics...
Extracting: List SD-WAN Configs...
Extracting: Get SD-WAN Config by ID...
Extracting: Get SD-WAN Config Status...
Processing Network v10.1.68...
Loading https://developer.ui.com/network/v10.1.68/gettingstarted...
โ Found 74 endpoints
โ 3 new endpoints found
Extracting: Adopt Devices...
Extracting: List DPI Application Categories...
Extracting: Quick Start...
Processing Protect v6.2.83...
Loading https://developer.ui.com/protect/v6.2.83/gettingstarted...
โ Found 41 endpoints
โ 36 new endpoints found
Extracting: Get application information...
Extracting: Get viewer details...
[... more endpoints ...]
Generating updated documentation...
โ Updated documentation saved to: docs/UNIFI_API.md
๐ Summary:
Site Manager: +4 new endpoints
Network: +3 new endpoints
Protect: +36 new endpoints
โ
Complete!
```
**Report back with:**
- Number of new endpoints discovered per API product
- Total lines added to documentation
- Any errors or warnings during extraction
- Git diff statistics showing the changes
**Safety checks:**
- Script only adds new endpoints, never removes existing content
- All official API URLs are hardcoded (no user input)
- Runs in headless mode (no manual interaction needed)
- Timeout handling for slow pages
- Error handling to skip problematic endpoints
**Notes:**
- The script uses Puppeteer to scrape public documentation (no authentication required)
- First run may take 2-3 minutes depending on network speed
- Subsequent runs will be faster as most endpoints are already documented
- Script is safe to run multiple times (idempotent)