0

Want to pass a string argument with spaces as follows:

get_post_data()
{
  cat <<EOF
{"incident":{"type":"incident","title":"$1","service":{"id":"123","type":"service_reference"}}}
EOF
}

send_notification()
{
  curl -X POST --header 'Content-Type: application/json' ... -d "$(get_post_data $1)" 'https://api.service.com/incidents'
}

send_notification Hello World!
Osman Mazinov
  • 1,436
  • 11
  • 33

0 Answers0