Help

Re: How can I learn the API from scratch?

1309 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Robert_Granhol1
5 - Automation Enthusiast
5 - Automation Enthusiast

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.

5 Replies 5
Moe
10 - Mercury
10 - Mercury

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

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. :winking_face:

//
// 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);
}
Chinara_James
6 - Interface Innovator
6 - Interface Innovator

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:

Getting Started with the Airtable API | Chinara James

Airtable is an easy way to get a database up and running for a side project or to quickly prototype an idea for app. I have used it to manage projects, expenses, client contacts and more.

Robert_Granhol1
5 - Automation Enthusiast
5 - Automation Enthusiast

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!

Hi - Do you have an example of how you might upload something to GitHub or a basic backend like Bluehost to host as a webpage?

Also, to hide the AIrtable direct API?