Adding and removing from a database using javascript

Hi, I was looking at the JavaScript functions in tadabase and was wondering, is there a way to use JavaScript to add and delete the records in a database?

Hi Tim, you can certainly use Javascript to manipulate records, but that would leave your API credentials exposed which we highly don’t recommend doing.

If you wanted an example code snippet here’s an example you can use to create a new record. You must be sure to update all the field_id’s and API credentials.

If there’s a more specific question, I’d be happy to help further. I do want to recommend you checkout the Tadabase Rest API Pipe which can likely achieve the same in a secure manner.

var form = new FormData();

form.append("field_35", "From API");
form.append("field_36", "Test 1");

var settings = {
    "url": "https://api.tadabase.io/api/v1/data-tables/eykNOvrDY3/records",
    "method": "POST",
    "timeout": 0,
    "headers": {
        "X-Tadabase-App-id": "YOUR_APP_ID",
        "X-Tadabase-App-Key": "YOUR_APP_KEY",
        "X-Tadabase-App-Secret": "YOUR_APP_SECRET",
    },
    "processData": false,
    "mimeType": "multipart/form-data",
    "contentType": false,
    "data": form
};$.ajax(settings).done(function (response) {
    console.log(response);
});
1 Like