1

If I use curl in windows CMD to get my result I am getting nodes with result (it's a single line CURL I am putting it as multiple for better overview):

curl --request POST "https://app.io/Id=Xz" 
--header "x-api-key: WHp" --header "Content-Type: application/json" 
--data-raw "{\"query\": \"{applications(limit: 2) {nodes {name}}}\" }"

Result is not empty and contains 2 nodes:

{"data":{"applications":{"nodes":[{"name":"node1"},{"name":"node2"}]}}}

Now I want to do the same in PowerShell but only getting the empty node result: data->applications->nodes which is why I suppose it connects properly but something in the filtering is the issue.

$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("x-api-key", "WHp")
$headers.Add("Content-Type", "application/json")
$body = '{"query": "{applications(limit:2) {nodes {name}}}"}'
Invoke-RestMethod 'https://app.io/Id=Xz' -Method 'POST' -Headers $headers -Body $body | ConvertTo-Json

Result:

{
  "data": {
    "applications": {
      "nodes": " "
    }
  }
}

I really tried many different cases how to send "double quotes" using Powershell, if that can be the issue but I am really not succeeding to make it work, even for days now... Very appreciate on your help!

vel
  • 1,000
  • 1
  • 13
  • 35

0 Answers0