lrj
3 天以前 6d519474e44855682043d3c40db2c86a6822caca
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
[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