Pushing data to an API trough Keyboard Maestro

It took me quite a while to grasp, but the answer was here as kindly put by @peternlewis himself, in Keyboard Maestro Forum.

Here’s the corresponding Keyboard Maestro Wiki entry. Look under the emacs example.

For me, I needed to replace every "$KMVAR_Variable" to "'"$KMVAR_Variable"'"

That’s because the Shell Script would not work if the statement is already between ', such as the data in the default curl script.

In the end, my curl command would read like this

curl -v -X POST https://api.airtable.com/v0/XXXXXXX/Table%201 \
  -H "Authorization: Bearer XXXXXX" \
  -H "Content-Type: application/json" \
  --data '{
  "records": [
    {
      "fields": {"Name": "'"$KMVAR_Var1"'", "Notes": "'"$KMVAR_Var2"'"}
    }
    ]
}'

If you happen to be a complete novice on curl as I still am, I’d recommend copying the codes from api.airtable.com and trying out yourself. It may look a bit daunting at first, but it most surely is not!