The first if statement looks at the url, if it’s the ‘Recently Added’ page it sets the same variable of datasetList to pass in the file name that makes the API call ( all.js), filters that data (sortByNewest) and limits the amount of items displayed to five. I also needed to filter the results by date to get the most recently added items first. Since pagination isn’t being used I had to create a way to pass in the name of the data source and limit the number of items displayed. We haven't added any datasets recently, sorry! npm install dotenv Ĭonst Airtable = require ( 'airtable' ) If you’re not familiar with how to use it the first two minutes of this video gave me all the information I needed to install, create the. npm install airtableĪnd I’m using dotenv here to hide my key. At least not yet!įirst you’ll need to install Airtable.js. I wish I could explain everything that’s going on in there, but I can’t. I was quickly was able to get it to work with my data and thanks to this comment in this Github issue I was able to refine it a bit more. I decided to take a look around GitHub to see if I could find any examples, and as I mentioned here I found and forked this repository, which uses Airtable.js, as a test. Previously I had tried to get a version of that call to work with Eleventy, but couldn’t figure out to make it work on its own outside of the structure of the Vue app. Those projects used Vue and the call is within the Vue app. In the API Key field, replace the API Key with a personal access token.In the current version of the project, as well as other projects, I’ve used Axios to access to Airtable. In the left panel, click Content, click Collections, and then the desired Airtable collection.Ĭlick Collection Settings located towards the bottom. To update an existing collection’s API with a Personal Access Token: Update an Existing Collection's API Key with a Personal Access Token Define the correct data type for each field.Return to Duda and paste it in the Example URL field.Copy the link under EXAMPLE (located in the Curl tab). ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |