BuiltOnAir

Easy External API Example

Created by: Creator: Ronald Vonk

Auto Creation/Population External API

This script just pulls pre-defined data from this website: reqres.in

  • Start a new Base (leave the table ‘Table 1’) and make three colums:

“First Name”

“Last Name”

“Email”

  • Start a new Script Block and copy-paste the below code.
  • Click ‘Run’ and watch the data being pulled in.

*** No Source: Script was submitted via BuiltOnAir ***

Script Code


							//Name your table 'Table 1'
let table = base.getTable('Table 1');

//Fetch url and translate to json
let url = await fetch('https://reqres.in/api/users');
let json = await url.json();

//Name your columns 'First Name', 'Last Name' and 'Email'
//Loop over the json object (key/value pairs)
for (i=0; i < json.data.length; i++) {
    let recordId = await table.createRecordAsync({
        "First Name": json.data[i].first_name,
        "Last Name": json.data[i].last_name,
        "Email": json.data[i].email
    })
}