in this week’s Tip of the Week, I’d like to share how you can delete all Records from a Tulip Table using the Table API.
warning: this deletes all Records from a Table, please use caution
there are three main steps to achieving this: 1. create a Bot in your instance, 2. build a Connector, 3. write the Connector Function.
navigate to https://{{instance_name}}.tulip.co/account-settings/bots (please note you need to be an Account Owner to open this page). once you’ve accessed this page, click Create Bot that can be found at the top right:
open the Headers section and paste the credentials from the Bot you just created. please note that the Username is the API Key and the Password is the Secret:
build a Connector Function with 1 input named tableID, DELETE as the method, and the following endpoint: /api/v3/tables/$tableID/records. as you see below the tableID in the URL will turn gray to confirm its been mapped to the Input:
once you enter a Table ID (found in the URL when you open a Table) in the Input and click Test (top right), you can Delete all the Table Records. and that’s it, you’re now ready to empty your Tables with just the click of a button!! again, please use caution as this deletes all records from your Table.
have people used this already?? if so, share why and when you use it.
I think the only issue was in the header url. Right now it is ...api/v2/tables/{tableid}/records but to embed the user inputted tableid it needs to be ...api/v2/tables/$tableid$/records.
I made this change in your connector, want to test it out and see if that works the way you’d expect it to?
As a note, if any of the records are currently loaded in a station, this DELETE request will fail. You can work around that by passing in a query parameter of allowRecordsInUse and set that to true.
Sorry about the delay on this one. Just duplicated your connector and got it working. There is was a bug introduced very recently around inputs to duplicated functions. Removing the input and re-adding it resolves this issue.
Hello,
If this issue was revived elsewhere, please point me in the right direction.
I’m trying to use it myself to empty several tables and on the way to learn a bit about connectors and functions. However, several things have changed I belive:
There aren’t any Bots anymore, now they’re called API Tokens, right?
For the life of me I can’t find the screen where I’m supposed to input the Token’s details into the connector: