File size: 1,978 Bytes
24780ab
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# 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
    }
}