前提1
> echo '$AUTH_KEY'
$AUTH_KEY
> echo '"$AUTH_KEY"'
"$AUTH_KEY"
> echo "$AUTH_KEY"
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> echo "'$AUTH_KEY'"
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
前提2
jsonのキーバリューはダブルクオートで囲む必要がある。
よって
// NG ペイロードは {"name": "$NAME"} になる
$ curl -XPOST -H "Authorization: $AUTH_KEY" -H "Content-Type: application/json"\
-d '{"name": "$NAME"}' https://localhost:3000/test
// OK
$ curl -XPOST -H "Authorization: $AUTH_KEY" -H "Content-Type: application/json"\
-d "{\"name\": \"$NAME\"}" https://localhost:3000/test
とにかくダブルクオートのみ(必要に応じてエスケープ)を使え。と覚えておく。