Help

Re: Updating a linked field through API

969 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Brian_McEuen
4 - Data Explorer
4 - Data Explorer

Hi All

I’m building an app with Adalo using Airtable as my database.

I have, as of now, 1 base with two tables, users and products. A product can have many users and a user can have many products. Obviously there is a linked field connecting Users → Products and it’s a multi-select linked field (a product can have many users).

I’m trying to “add” a user or “append” a user to the user array through the airtable API (PATCH) and each time I get something to work, I can only get it to overwrite the current user in that table as opposed to adding a new user.

Any thoughts on what I’m missing here?

Thanks!

2 Replies 2
Olivia_B
5 - Automation Enthusiast
5 - Automation Enthusiast

pm sent , please check

SergioCodes
8 - Airtable Astronomer
8 - Airtable Astronomer

Hi there @Brian_McEuen

Based on the documentation:

A PATCH request will only update the fields you specify, leaving the rest as they were. A PUT request will perform a destructive update and clear all unspecified cell values.

In this case, I think you are looking for a way to “create if not exist,” which is not available in the API; I do recommend looking for the record using GET with filterByFormula=, and if the result is an empty array, then create it POST, else update it (PATCH)

If you need any help and you have a budget, then we can talk.

Best
Sergio