Get Record

Script airtable Verified

by nicolasdymkowy ยท 6/6/2022

The script

Submitted by henri186 Deno
Verified 382 days ago
1
import { Airtable } from "https://deno.land/x/airtable/mod.ts";
2

3
type Airtable = {
4
  apiKey: string;
5
};
6

7
type AirtableTable = {
8
  baseId: string;
9
  tableName: string;
10
};
11
export async function main(
12
  atCon: Airtable,
13
  atTable: AirtableTable,
14
  recordId?: string,
15
) {
16
  const airtable = new Airtable({ ...atCon, ...atTable });
17

18
  if (recordId) {
19
    const record = await airtable.find(recordId);
20
    return { result: record };
21
  } else {
22
    const records = await airtable.select().all();
23
    return { result: records };
24
  }
25
}
26

Other submissions
  • Submitted by rossmccrann Deno
    Created 1413 days ago
    1
    import { Airtable } from "https://deno.land/x/airtable/mod.ts";
    2
    
    
    3
    
    
    4
    export async function main(at_con: wmill.Resource<"airtable">, recordId: string) {
    5
        const airtable = new Airtable(at_con);
    6
    
    
    7
        const record = await airtable.find(recordId)
    8
      
    9
        return {result: record};
    10
    }