Apr 14, 2021 04:47 AM
I want to create an API end point to delete records based on a user_id (or any field other than the records’ id). In other words, the equivalent of SQL DELETE FROM {table} WHERE user_id = {x}
.
Airtable’s built-in API only allows to delete records based on their ID, not on any other field.
Is this possible?
Apr 15, 2021 03:07 PM
One way to do this is to use our service, Sync Inc, to quickly query for all the records:
SELECT id FROM {table} WHERE user_id = {X}
Then, use our proxy to delete the specific records.
This will be a two step process either way - but at least its easier with SQL :slightly_smiling_face:
Apr 15, 2021 08:37 PM
Welcome to the Airtable community!
You can create an automation that is triggered by a webhook. Send the user id (or record id or other identifying info) in the post body. Then run a scripting action that deletes the record. If you want to delete records based on something other than the record id, you can have the script identify the record based on whatever field you like.