I can not get the following to work in PowerShell script, how would you break down the following?
jq -n --arg schema "$(cat schema.graphql)" '{ query: "mutation addSchema($sch: String!) { addSchema(input: { schema: $sch }) { schema { schema } } }", variables: { sch: $schema }}' | curl -X POST -H "Content-Type: application/json" http://localhost:5500/admin -d @- | jq -r
I have the following:
function Add-this(){
Param
(
[Parameter(Mandatory=$true)]
[string]$Target,
[Parameter(Mandatory=$true)]
[string]$FileName
)
$Body = jq -n --arg schema "$(cat $FileName)" '{ query: "mutation addSchema($sch: String!) { addSchema(input: { schema: $sch }) { schema { schema } } }", variables: { sch: $schema }}'
Invoke-RestMethod -Headers $headers -Method Post -Uri "http://$Target:5500/admin" -Body ...
}