# Test the action-types endpoint # Login first $loginBody = @{ username = "admin" password = "admin123" } | ConvertTo-Json try { $loginResponse = Invoke-WebRequest -Uri "http://localhost:8000/api/v1/auth/login" ` -Method POST ` -Body $loginBody ` -ContentType "application/json" ` -UseBasicParsing $loginData = $loginResponse.Content | ConvertFrom-Json $token = $loginData.access_token Write-Host "Logged in successfully" -ForegroundColor Green } catch { Write-Host "Login failed: $($_.Exception.Message)" -ForegroundColor Red exit 1 } # Test action-types endpoint Write-Host "`nTesting /api/v1/configuration/action-types..." -ForegroundColor Cyan try { $response = Invoke-WebRequest -Uri "http://localhost:8000/api/v1/configuration/action-types" ` -Headers @{ "Authorization" = "Bearer $token" "Content-Type" = "application/json" } ` -Method GET ` -UseBasicParsing $data = $response.Content | ConvertFrom-Json Write-Host "Success!" -ForegroundColor Green Write-Host "Total action types: $($data.total_types)" -ForegroundColor Yellow Write-Host "`nSample action types:" -ForegroundColor Cyan $count = 0 foreach ($prop in $data.action_types.PSObject.Properties) { if ($count -ge 5) { break } Write-Host " - $($prop.Name)" -ForegroundColor White Write-Host " Description: $($prop.Value.description)" -ForegroundColor Gray Write-Host " Category: $($prop.Value.category)" -ForegroundColor Gray Write-Host " Parameters: $($prop.Value.parameters -join ', ')" -ForegroundColor Gray Write-Host "" $count++ } } catch { Write-Host "Error: $($_.Exception.Message)" -ForegroundColor Red # Try to read response body $reader = New-Object System.IO.StreamReader($_.Exception.Response.GetResponseStream()) $errorBody = $reader.ReadToEnd() Write-Host "`nError Body:" -ForegroundColor Yellow Write-Host $errorBody } # Test specific action type Write-Host "`nTesting /api/v1/configuration/action-types/PanLeft..." -ForegroundColor Cyan try { $response = Invoke-WebRequest -Uri "http://localhost:8000/api/v1/configuration/action-types/PanLeft" ` -Headers @{ "Authorization" = "Bearer $token" "Content-Type" = "application/json" } ` -Method GET ` -UseBasicParsing $data = $response.Content | ConvertFrom-Json Write-Host "Success!" -ForegroundColor Green Write-Host "Action Name: $($data.action_name)" -ForegroundColor Yellow Write-Host "Description: $($data.description)" -ForegroundColor White Write-Host "Category: $($data.category)" -ForegroundColor White Write-Host "Parameters: $($data.parameters -join ', ')" -ForegroundColor White } catch { Write-Host "Error: $($_.Exception.Message)" -ForegroundColor Red }