Skip to main content

Newbie Getting Started with Returning JSON

  • March 29, 2020
  • 2 replies
  • 13 views

I’m struggling to find any docs of examples or returning a JSON packet of records from a module.export = function () {} block using the Airtable.js library;

Can someone point me in the right direction?

2 replies

  • Author
  • New Participant
  • 1 reply
  • March 29, 2020

So I did this with Axios and it returns the result I’m after. How would I do this with Airtable.js?

module.exports = async function () {
	return axios.get(
		"https://api.airtable.com/v0/" + baseKey + "/Hours?view=Grid%20view",
		{
			headers: { Authorization: "Bearer " + apiKey }
		}
	).then( function ( response ) {
		return response.data.records;
	} ).catch( function ( error ) {
		console.log( error );
	} );
};

Forum|alt.badge.img+4
  • Inspiring
  • 60 replies
  • April 10, 2020

The Airtable API documentation has a section for the JavaScript library. It’s kind of hidden away, so you might have missed it:

Does that help?