Feb 14, 2022 08:40 AM
Hello,
I’m trying to understand the AT API when it comes to getting the values of a linked table.
For example, in Table one I have the following fields:
ID
Entity Name
List of Part IDs
In Table 2 I have the following fields:
ID
Part Number
Part Name
So when I create the URL to pull the values in Table 1, how do I “lookup” and show the Part Number and Part Name from Table 2 for each Part ID in Table 1?
I’m new to Airtable, and have spent hours and hours trying to figure this out, but so far have been unsuccessful. All help will be greatly appreciated.
Thanks,
George
Feb 14, 2022 11:29 AM
Hi George, and welcome to the community!
The API doesn’t expose data in its linked form; it provides only the raw data. As such, you must perform all of the relational logic in the script environment; ergo - you must request both tables - the primary and related linked table and then mash them together.
Yeah, that sucks, right?
The only way I have been able to overcome this is to enhance the API with a logical GraphQL layer and that’s a lot of work. One client of mine was building so many API integrations with many developers that a GraphQL layer actually made practical financial sense. But if it’s just you and two related tables, strap in and enjoy the wild ride building a process that iterates across the primary table and uses the record IDs exposed in the linked fields to match up with the secondary table.
Feb 14, 2022 03:59 PM
Thanks @Bill.French. Not the answer I was hoping for. LOL. At least I know I wasn’t crazy. GraphQL is beyond my current experience, so based on your explanation think I’ll go a different route. :frowning:
Thanks again!
Oct 13, 2024 08:56 AM - edited Oct 19, 2024 05:39 PM
Hey George (and anyone else who might find this helpful),
I know this thread is from 2022, but for anyone still trying to solve this in 2024 and beyond, I wanted to share an updated resource. Like Bill mentioned, Airtable’s API requires pulling data from linked tables separately and merging it manually.
If you're still facing this issue, I’ve written an article that walks through both approaches: one using Airtable’s API and another using a GraphQL layer (like BaseQL) that makes it much easier to query linked records directly. You can check it out here: Cross-Table Joins with Airtable API.
Hope this helps anyone still searching for a solution!
DJ, Lead Developer at BaseQL