This is part four of our tutorial series on working with the Airtable API in dashdash. To follow along, make sure you’ve completed the previous tutorials.
So, you know know how to get and create entries in Airtable, the next step is to learn how to update an antry that’s already there. Updating an entry in Airtable is a bit finicky, as we need to use the
PUT() function. But don’t worry - the boffins here are dashdash have got you covered.
In this tutorial, we’ll walk through:
- PUT requests in Airtable (a bit of theory)
- creating a PUT request to update a single entry
First, let’s set up our PutToAirtable view:
|B1||Remove square brackets|
|D1||Access URL and ID|
|A5||Copy in the entire header row from GetAirtableData, but remove the createdTime header.|
PUT requests in Airtable
According to the Airtable API documentation, a PUT HTTP request is “destructive,” by which they mean that when you use PUT, it overrides any fields that are not included in your call.
For example, let’s say we have an entry like this:
And we want to update the
If we send just those two fields, the existing fields will be overwritten in Airtable. Which is probably not what you want when you’re trying to just update something. However, the boffins here at dashdash have a workaround.
When you use the PUT() function, you actually send all the fields, even the ones that you haven’t updated.
So, let’s update the entry we created in Part 3 of the series.
Add the following content to our PutToAirtable view: | Cell | Content |
| A8 | My first post from dashdash! |
| B8 | Feature |
| C8 | It’s just easier with dashdash. |
|H8 | Published |
By the end, your view should look something like this:
Now, we can create our PUT request .
Creating our PUT request
Other than the “update” nature of a PUT request, the only real difference between the PostToAirtable and PutToAirtable views is that we need to add the
id of the entry we want to update to the end of our Access URL (see the formula for cell D2 in the table below).
Add the following content to our PutToAirtable view:
||Creates our JSON object|
||Removes the square brackets|
||Puts everything in a
||When you click the Update button, it’ll send the PUT request to update your entry|
All that’s left to do now is to press the Update button, and then have a look in the data explorer to see the updates!
And that’s it! You’ve just updated your entry in Airtable.
If you’ve followed this series diligently, you’ll now have the solid fundamentals of working with the Airtable API via dashdash - the rest, well, is up to you
We can’t wait to see what you create!
The dashdash team