-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate-test-request.ps1
More file actions
50 lines (43 loc) · 1.92 KB
/
Copy pathcreate-test-request.ps1
File metadata and controls
50 lines (43 loc) · 1.92 KB
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
# Create a sample credit request via the CreditAI API
$apiUrl = "http://localhost:5248/api/credit-requests"
$body = @{
subjectName = "Empresa Teste Lda"
subjectTaxId = "503123456"
subjectType = "Company"
segment = "Sme"
applicantMarket = "Portugal"
amountRequested = 100000
termMonths = 36
purpose = "IT equipment - system test"
collateralDescription = "Purchased equipment"
} | ConvertTo-Json
Write-Host "Creating sample credit request..." -ForegroundColor Cyan
Write-Host "URL: $apiUrl" -ForegroundColor Gray
Write-Host ""
try {
$response = Invoke-WebRequest -Uri $apiUrl -Method POST `
-Body $body `
-ContentType "application/json" `
-UseBasicParsing `
-Headers @{ Authorization = "Bearer dev" }
$result = $response.Content | ConvertFrom-Json
Write-Host "Request created." -ForegroundColor Green
Write-Host ""
Write-Host "Request ID: $($result.id)" -ForegroundColor Yellow
Write-Host "Status: $($result.status)" -ForegroundColor Yellow
Write-Host ""
Write-Host "Open the Web app:" -ForegroundColor Cyan
Write-Host " - Dashboard: http://localhost:5188" -ForegroundColor White
Write-Host " - Requests: http://localhost:5188/requests" -ForegroundColor White
Write-Host " - Manual data: http://localhost:5188/manual-data" -ForegroundColor White
} catch {
Write-Host "Failed to create request:" -ForegroundColor Red
Write-Host $_.Exception.Message -ForegroundColor Red
Write-Host ""
Write-Host "Tip: ensure the API is running in Development and accepts Bearer dev." -ForegroundColor Yellow
Write-Host ""
Write-Host "Alternative: create the request in the Web UI" -ForegroundColor Cyan
Write-Host " 1. Open http://localhost:5188" -ForegroundColor White
Write-Host " 2. Login: admin@creditai.local / ChangeMe@1234" -ForegroundColor White
Write-Host " 3. New request → submit" -ForegroundColor White
}