[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
$headers = @{
|
"Content-Type" = "application/json"
|
}
|
|
Write-Host "=== Simple Query Test ==="
|
|
# Test: Query all activities to see if basic query works
|
Write-Host "1. Querying all activities..."
|
$body1 = @{
|
query = 'query {
|
allActivities {
|
id name pid
|
}
|
}'
|
} | ConvertTo-Json
|
|
$response1 = Invoke-RestMethod -Uri "http://localhost:8080/api/graphql" -Method POST -Body $body1 -Headers $headers
|
Write-Host "All activities result:"
|
$response1 | ConvertTo-Json -Depth 10
|
|
# Test: Query activities with pagination
|
Write-Host "`n2. Querying activities with pagination..."
|
$body2 = @{
|
query = 'query {
|
activities(page: 0, size: 10) {
|
content { id name pid }
|
totalElements
|
}
|
}'
|
} | ConvertTo-Json
|
|
$response2 = Invoke-RestMethod -Uri "http://localhost:8080/api/graphql" -Method POST -Body $body2 -Headers $headers
|
Write-Host "Paginated activities result:"
|
$response2 | ConvertTo-Json -Depth 10
|