Help

Newbie Getting Started with Returning JSON

Topic Labels: API
1923 2
cancel
Showing results for 
Search instead for 
Did you mean: 
Richard_Herbert
4 - Data Explorer
4 - Data Explorer

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 2
Richard_Herbert
4 - Data Explorer
4 - Data Explorer

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 );
	} );
};
Mike_Pennisi
7 - App Architect
7 - App Architect

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?