# Test POST /api/hidden-links
# 1. Replace YOUR_API_KEY with your actual API key from Settings > API Keys
# 2. Run: .\test-api-post.ps1

$apiKey = "YOUR_API_KEY"
$uri = "http://127.0.0.1:8000/api/hidden-links"

$body = @{
    payload = @(
        @{ url = "https://www.example.com/page1"; keyword = "admin"; nofollow = $false }
        @{ url = "https://www.example.com/page2"; keyword = "casino"; nofollow = $true }
    )
    batch_id = 2
    chunk_id = 0
} | ConvertTo-Json -Depth 5

$headers = @{
    "Authorization" = "Bearer $apiKey"
    "Content-Type"  = "application/json"
    "Accept"       = "application/json"
}

try {
    $response = Invoke-RestMethod -Uri $uri -Method POST -Headers $headers -Body $body
    $response | ConvertTo-Json -Depth 5
} catch {
    Write-Host "Status:" $_.Exception.Response.StatusCode.value__
    $reader = New-Object System.IO.StreamReader($_.Exception.Response.GetResponseStream())
    $reader.BaseStream.Position = 0
    Write-Host $reader.ReadToEnd()
}
