Skip to main content

Airtable

Airtable can store information in a spreadsheet that's visually appealing and easy-to-use

Official Websitehttps://airtable.com/
TagsDatabaseSaas

Credential configuration

To configure this credential, you need your Airtable API KEY, check this page to find out how to get it.

Extended options support any additional parameter like endpointUrl or requestTimeout.

Here is an example of a filled credential configuration form in YepCode:

Airtable snippets available in editor

note

The title is the triggering text for YepCode to autocomplete the script.

Integration

New integration from credential
const airtableClient = yepcode.integration.airtable('credential-slug')
New integration from plain authentication data
const Airtable = require('airtable')

const airtableClient = new Airtable({
apiKey: 'your_api_key'
})

Select Records

Select records from base
airtableClient.base('baseName').select({
maxRecords: 30,
view: "Grid view"
}).eachPage(function page(records, fetchNextPage) {
records.forEach(function(record) {
console.log('Retrieved', record.get('productId'));
});
fetchNextPage();

}, function done(err) {
if (err) { console.error(err); return; }
});

Find Records

Find one record by id
airtableClient.base('baseName').find('recordId', function(err, record) {
if (err) { console.error(err); return; }
console.log('Retrieved', record.id);
});

Create Records

Create records
airtableClient.base('baseName').create([
{
"fields": {
"productId": 1,
"stock": 10
}
},
{
"fields": {
"productId": 1,
"stock": 20
}
}
], function(err, records) {
if (err) {
console.error(err);
return;
}
records.forEach(function (record) {
console.log(record.getId());
});
});

Update Records

Update records
airtableClient.base('baseName').update([
{
"id": "recordId",
"fields": {
"stock": 20
}
},
{
"id": "otherRecordId",
"fields": {
"stock": 20
}
}
], function(err, records) {
if (err) {
console.error(err);
return;
}
records.forEach(function (record) {
console.log(record.getId());
});
});

Delete Records

Delete records
airtableClient.base('baseName').destroy(['recordId'], function(err, deletedRecords) {
if (err) {
console.error(err);
return;
}
console.log('Deleted', deletedRecords.length, 'records');
});