I'm passing "--data" via curl to a GraphqQL API endpoint.
I want to be able to pass the data in 'prettified' form, e.g. as in GraphiQL browser,
{
alpha {
param1
param2
}
}
Atm, my formatting inside the data -- namely, re: line returns -- isn't handled properly.
This single-line-string form works,
curl \
-H 'content-type: application/json' \
-X POST /path/to/graphql/api/endpoint \
--data '{ "query":
"query { alpha {param1, param2} } "
}'
This 'prettified' version does not
curl \
-H 'content-type: application/json' \
-X POST /path/to/graphql/api/endpoint \
--data '{ "query":
"query {
alpha {
param1
param2
}
} "
}'
What's the right syntax for passing the 2nd form?
I'm guessing some combination of quoting/escaping?