I keep forgetting the syntax for these two things, so there’s a chance writing it here will help me remember.
Possibly of use/relevance for: elasticsearch or Debezium….
curl -si -X POST -H 'Accept:application/json' \
-H 'Content-Type:application/json' \
http://something:port/somewhere --data @<( cat <<EOF
{
"java.script": stuff,
"goes.here": "${ENV_VAR_CAN_BE_USED}"
}
EOF
)
So ‘cat’ reads till EOF, and outputs on a file descriptor, that the shell passes to curl…
The above ‘@<(‘ can be also used with jq – for example with ElasticSearch to reduce the replica requirements for a testing environment :
curl -si -X PUT -H 'Content-Type:application/json' \
http://elastic.search.server:9200/index_name \
-d @<(
jq -c ".settings.index={number_of_shards:1,number_of_replicas:0}" ./existing/file/mapping.json
)