Airtable - List Records
@dylan
code:
data:privatelast updated:4 years ago
today
Build integrations remarkably fast!
You're viewing a public workflow template.
Sign up to customize, add steps, modify code and more.
Join 1,000,000+ developers using the Pipedream platform
steps.
trigger
HTTP API
Deploy to generate unique URL
This workflow runs on Pipedream's servers and is triggered by HTTP / Webhook requests.
steps.
airtable_list_records
Lists records in a given table.
auth
(auths.airtable)
params
Base id
 
string ·params.base_id
Table name
 
string ·params.table_name
Sort

A list of sort objects that specifies how the records will be ordered. Each sort object must have a field key specifying the name of the field to sort on, and an optional direction key that is either "asc" or "desc". The default direction is "asc"

Field
Name
string ·params.sort.0.field
Direction
string ·params.sort.0.direction
array ·params.sort
Optional
code
async (params, auths) => {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
}
32

var sort = "";
if(params.sort){
    var i = 0;        
    for (const s of params.sort) {        
      var prefix = i==0 ? "?" : "&";
      var sort_param = `${prefix}sort[${i}][field]=${s.field}&sort[${i}][direction]=${s.direction}`;
      sort = sort + sort_param;
      i++;
    }
}

const config = {
  url: `https://api.airtable.com/v0/${params.base_id}/${encodeURIComponent(params.table_name)}${sort}`,
  params: {
    fields: params.fields,
    filterByFormula: params.filterByFormula,
    maxRecords: params.maxRecords,
    pageSize: params.pageSize,    
    view: params.view,
    cellFormat: params.cellFormat,
    timeZone: params.timeZone,
    userLocale: params.userLocale,
    offset: params.offset,
  },
  headers: {
    Authorization: `Bearer ${auths.airtable.api_key}`,
  },
}
return await require("@pipedreamhq/platform").axios(this, config)