jilonutrition.blogg.se

Airtable api php
Airtable api php











  • It’s possible that not all table2 records referenced inside table1 were retrieved due to the filterByFormula, so while there may have been 10 related record IDs, only 4 related records where joined.
  • That joinRecords function is precarious though, because: The joinRecords() method could do something like this: 5,OR(RECORD_ID() = 'xxxxxxxxxxxxxxx',RECORD_ID() = 'xxxxxxxxxxxxxxx'.))" ?> $params = array("relatedTo" => $relatedTo, "filterByFormula" => $filterByFormula, "fields" => $fields) Īnd then the getTable method would produce something like: $fields = array("Item Name", "Item Cost", "Inventory ID") Here’s another example, this time with more filtering: 5" $orders = $airtable->joinRecords($orders,"Items",$items) Īs you may surmise, the getTable function looks for my custom $relatedTo parameter (which is NOT a part of the Airtable API) and creates something like this by looping through the Orders and snagging the RECORD_ID() from each ‘Items’ field: $items = $airtable->getTable($table,$params) $params = array("relatedTo" => $relatedTo)

    airtable api php

    $params = array("filterByFormula" => $filterByFormula)

    AIRTABLE API PHP CODE

    Here’s the jist of the code I use-obviously there’s more going on behind the scenes, but this illustrates the concept: ''" By using the filterByFormula parameter with the OR() condition, it’s possible to get a bunch of records from TABLE1 and then in a single API call, get ALL related records from TABLE2. This could result in many individual API calls and become excessively slow. Until Airtable releases a method for fetching related records “automatically” via the API, a person must manually retrieve related records by RECORD_ID(). I’ve written a PHP API wrapper for Airtable that is highly customized and specific to my particular needs, however one concept that is worth passing along is how I fetch “related records”. What language are you using (or anticipate using) to access the API?











    Airtable api php