Help

API returns error with variable from Keyboard Maestro

Topic Labels: API
743 0
cancel
Showing results for 
Search instead for 
Did you mean: 
brijazz
5 - Automation Enthusiast
5 - Automation Enthusiast

I’m using Keyboard Maestro to build a script to update a record based on user input. The user will input the customer’s record ID, info to update and the script will be built like so:

curl -v -X PATCH https://api.airtable.com/v0/xxxxxxxx/Students%2C%20Parents%2C%20Prospectives \
  -H "Authorization: Bearer xxxxxxxx" \
  -H "Content-Type: application/json" \
  --data '{
  "records": [
    {
      "id": "'$KMVAR_ATRecordID'",
      "fields": {
        "Status": "'$KMVAR_Status'",
	"Lesson Day": [ "'$KMVAR_Lesson_Day'" ],
	"Teacher": [ "'$KMVAR_Teacher'" ],
	"Instrument": [ "'$KMVAR_Instrument'" ]
      }
    }
  ]
}'

This fails, with the API saying that “You must provide an array of up to 10 record objects, each with an “id” ID field and a “fields” object for cell values”.

However, if I remove the “Teacher” line the script works correctly:

curl -v -X PATCH https://api.airtable.com/v0/xxxxxxxx/Students%2C%20Parents%2C%20Prospectives \
  -H "Authorization: Bearer xxxxxxxx" \
  -H "Content-Type: application/json" \
  --data '{
  "records": [
    {
      "id": "'$KMVAR_ATRecordID'",
      "fields": {
        "Status": "'$KMVAR_Status'",
	"Lesson Day": [ "'$KMVAR_Lesson_Day'" ],
	"Teacher": [ "'$KMVAR_Teacher'" ],
	"Instrument": [ "'$KMVAR_Instrument'" ]
      }
    }
  ]
}'

I can NOT figure out what the issue is with that one line. The variable has a valid value in Keyboard Maestro. Any suggestions?

0 Replies 0