Can't send values to Airtable API using patch

Struggling with parabola ‘send to api’ module while trying to update an airtable table.
I’m doing an update (patch) and I’m trying to send some numerical values.

{
  "records": [
    {
      "id": "{inventory record id}",
 "fields": {
 "sku":"{sku}",
 "in stock":"{in stock}",
 "prev stock":"{prev stock}",
 "updated":"{updated}"
        }
    }
  ]
}

If I send this I get an error stating that the ‘in stock’ and ‘prev stock’ can’t accept the values (because airtable is seeing the values as text trying to be inserted into a number field).

This works fine when creating records (Post) as I use typecast: true. It doesn’t work for Patch though even if I add typecast: true. It throws a different error.

If I change the json to this and remove the quotes from the value fields :-

{
  "records": [
    {
      "id": "{inventory record id}",
 "fields": {
 "sku":"{sku}",
 "in stock":{in stock},
 "prev stock":{prev stock},
 "updated":{updated}
        }
    }
  ]
}

Then it says my json isn’t valid.

Any ideas?

Thanks

Jonathan

Hi Jonathan,

Are “in stock” or “prev stock” ever blank in your flow? If so, if they’re returning a blank into the json that might cause it to be invalid.

Best,
Michelle

Hi Michelle

Good point, but I run a regex that replaces ^$ with a 0 just in case.

I have it working now and it appears that I need the updated field (datetime field) to be in quotes:-

{
  "records": [
    {
      "id": "{inventory record id}",
 "fields": {
 "sku":"{sku}",
 "in stock":{in stock},
 "prev stock":{prev stock},
 "updated":"{updated}"
        }
    }
  ]
}

This now works :slight_smile:

This was my first use of Parabola webhooks to bring in shopify orders into airtable.

It took me about 30 credits to get it working but I got there in the end!!

Thanks

Jonathan

Good catch with the date field and glad you got it working!

@Jonathan_Lyon – glad you got this working. Sorry you had to use so many credits though…send me a note (along with the email address associated with your Parabola account) at andrew@parabola.io and I’ll refund those for you :slight_smile: