Updating a linked field through API

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!

pm sent , please check

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

1 Like

This topic was solved and automatically closed 15 days after the last reply. New replies are no longer allowed.