Scenario :

A developer wants to send json containing spaces in the values to a FAAS function. The payload for the function is a json with three name-value pairs : commodity, role_name and subsidiary_name. The values may contain spaces. This trick is one way to send to the function using curl from the command line. Prevents the curl function from failing to understand

Quick Tips and Tricks :

brew install jo
c="NG"
r="Settlements"
s="ABC, LLC"
apiurl="http://localhost/function/somefunction"
curldata=$(jo commodity="$c" role_name="$r" subsidiary_name="$s")
curl -d "$curldata" "$apiurl"

%d bloggers like this: