# PowerShell script to test the quiz solver API # Fixes SSL/TLS certificate validation issues # Bypass SSL certificate validation (for development/testing only) # WARNING: This reduces security - only use for testing with trusted endpoints add-type @" using System.Net; using System.Security.Cryptography.X509Certificates; public class TrustAllCertsPolicy : ICertificatePolicy { public bool CheckValidationResult( ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) { return true; } } "@ [System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 -bor [System.Net.SecurityProtocolType]::Tls13 # Configuration $apiUrl = "http://localhost:8000/demo" # Change to your API URL $email = "test@example.com" $secret = "default_secret_change_me" # Change to your secret $quizUrl = "https://tds-llm-analysis.s-anand.net/project2" # Create request body $body = @{ email = $email secret = $secret url = $quizUrl } | ConvertTo-Json # Make the API call try { Write-Host "Calling API: $apiUrl" -ForegroundColor Cyan Write-Host "Request body:" -ForegroundColor Yellow Write-Host $body -ForegroundColor Gray $response = Invoke-RestMethod ` -Uri $apiUrl ` -Method POST ` -ContentType "application/json" ` -Body $body Write-Host "`nResponse:" -ForegroundColor Green $response | ConvertTo-Json -Depth 10 | Write-Host -ForegroundColor White } catch { Write-Host "`nError occurred:" -ForegroundColor Red Write-Host $_.Exception.Message -ForegroundColor Red if ($_.ErrorDetails.Message) { Write-Host "Details:" -ForegroundColor Yellow Write-Host $_.ErrorDetails.Message -ForegroundColor Gray } }