Nice here document feature I have found recently is heredoc with pipe, e.g.
cat <<REQUEST_BODY |
{
"from" : 0,
"size" : 40
}
REQUEST_BODY
curl http://localhost -d @-
It allows to pass heredoc text to standard input of next command.