How can I learn the API from scratch?

I’m struggling to find anything on the web to teach me how to builds outputs from the API from scratch.

Is it a prerequisite that I am already accomplished with Javascript? [I know programming concepts and am a beginner]

Youtube and Google have a few sparse videos but nothing like a course I can take that will bring me up to speed quickly.

If you have no experience with APIs whatsoever, I’d recommend starting with this course by Zapier: https://zapier.com/learn/apis/

And once ready, I’d suggest playing with Airtable’s official javascript client https://github.com/Airtable/airtable.js

2 Likes

No, but some experience is helpful. Here’s one approach to learning -

  1. Create a base and a simple table with ten records and a single field called “Name”.
  2. Create a Google spreadsheet
  3. Open a script project (see Tools | Script Editor)
  4. Paste the code into the script
  5. Change the baseName, baseID, tableName, and airtableAPIKey
  6. Save the script file (see disk button in top menu)
  7. Run the script function (see > play button in the top menu)
  8. Select View | Logs in the top menu - you should see ten record numbers and names listed.

Now you’re an API programmer. :wink:

//
// static vars
//
var baseName            = "<base name>";
var baseID              = "<base id>";
var tableName           = "<table name>";
var airtableAPIKey      = "<api key>";
var airtableAPIEndpoint = "https://api.airtable.com/v0/";

//
// get my table (first 100 records only)
//
function testGetMyTable()
{
  
  // fetch the 
  var results = atGetMyTable_(tableName);
  
  // parse the api results from airtable
  var aRecords = JSON.parse(results).records;
  
  // enumerate the records
  for (var i in aRecords)
  {
    // log the record id's
    Logger.log(aRecords[i].id + " :: " + aRecords[i].fields["Name"]);
  }
  
  return(true);
  
}

function atGetMyTable_(tableName)
{
  const options = {
    method: 'GET',
    headers: {
      'Authorization' : 'Bearer ' + airtableAPIKey,
      'Content-type': 'application/json'
    },
    muteHttpExceptions : true
  };
  var response = UrlFetchApp.fetch(airtableAPIEndpoint + baseID + "/" + encodeURIComponent(tableName), options).getContentText();
  return(response);
}
1 Like

I’m not sure what you are trying to achieve or what level you want to start at but I have a few tutorials on my blog about getting started with the Airtable API. You can start with this one first:

1 Like

Thanks all, these are great! I’m going to work my way through them a learn more.

I see Airpress does a lot of what I want, but I also want to know how to custom create my display and search on sites, thanks!