Files
claudetools/clients/internal-infrastructure/scripts/test-api-endpoint.ps1
Mike Swanson 5cbd49ce24 Reorganize repo: compartmentalize scripts by client/project
Move 150+ scripts from root and scripts/ into client/project directories:
- clients/dataforth/scripts/ (110 files: AD2, sync, SSH, DB, DOS scripts)
- clients/bg-builders/scripts/ (14 files: Lesley mgmt, Exchange, termination)
- clients/internal-infrastructure/scripts/ (10 files: GDAP, Gitea, backups)
- projects/msp-tools/scripts/ (9 files: CIPP, MSP onboarding, Datto)
- projects/gururmm-agent/scripts/ (3 files: API test, JWT, record counts)
- clients/glaztech/scripts/ (1 file: CentraStage removal)

Also reorganized:
- VPN scripts → infrastructure/vpn-configs/
- Retrieved API/JS files → api/
- Forum posts → projects/community-forum/forum-posts/
- SSH docs → clients/internal-infrastructure/docs/
- NWTOC/CTONW docs → projects/wrightstown-smarthome/docs/
- ACG website files → projects/internal/acg-website-2025/
- Dataforth docs → clients/dataforth/docs/
- schema-retrieved.sql → docs/database/

Deleted 24 tmp_*.ps1 one-off debug scripts (preserved in git history).
Root reduced from 220+ files to 62 items (docs + directories only).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 17:15:07 -07:00

48 lines
2.1 KiB
PowerShell

# Test the API endpoint directly
Write-Host "[OK] Testing API endpoints on AD2..." -ForegroundColor Green
# Test 1: Stats endpoint
Write-Host "`n[TEST 1] GET /api/stats" -ForegroundColor Cyan
try {
$response = Invoke-WebRequest -Uri "http://192.168.0.6:3000/api/stats" -Method GET -UseBasicParsing -ErrorAction Stop
Write-Host "[OK] Status: $($response.StatusCode)" -ForegroundColor Green
Write-Host "[OK] Response:" -ForegroundColor Green
$response.Content | ConvertFrom-Json | ConvertTo-Json -Depth 5
} catch {
Write-Host "[ERROR] Request failed: $($_.Exception.Message)" -ForegroundColor Red
Write-Host "[ERROR] Response: $($_.Exception.Response)" -ForegroundColor Red
if ($_.ErrorDetails.Message) {
Write-Host "[ERROR] Details: $($_.ErrorDetails.Message)" -ForegroundColor Red
}
}
# Test 2: Search endpoint (simple)
Write-Host "`n[TEST 2] GET /api/search?limit=1" -ForegroundColor Cyan
try {
$response = Invoke-WebRequest -Uri "http://192.168.0.6:3000/api/search?limit=1" -Method GET -UseBasicParsing -ErrorAction Stop
Write-Host "[OK] Status: $($response.StatusCode)" -ForegroundColor Green
Write-Host "[OK] Response:" -ForegroundColor Green
$response.Content | ConvertFrom-Json | ConvertTo-Json -Depth 5
} catch {
Write-Host "[ERROR] Request failed: $($_.Exception.Message)" -ForegroundColor Red
if ($_.ErrorDetails.Message) {
Write-Host "[ERROR] Details: $($_.ErrorDetails.Message)" -ForegroundColor Red
}
}
# Test 3: Record by ID
Write-Host "`n[TEST 3] GET /api/record/1" -ForegroundColor Cyan
try {
$response = Invoke-WebRequest -Uri "http://192.168.0.6:3000/api/record/1" -Method GET -UseBasicParsing -ErrorAction Stop
Write-Host "[OK] Status: $($response.StatusCode)" -ForegroundColor Green
Write-Host "[OK] Response:" -ForegroundColor Green
$response.Content | ConvertFrom-Json | ConvertTo-Json -Depth 5
} catch {
Write-Host "[ERROR] Request failed: $($_.Exception.Message)" -ForegroundColor Red
if ($_.ErrorDetails.Message) {
Write-Host "[ERROR] Details: $($_.ErrorDetails.Message)" -ForegroundColor Red
}
}
Write-Host "`n[OK] Done" -ForegroundColor Green