How to perform a basic Retool database via an API Call?

  • Goal: I am trying to build a workflow that downloads time entries from an API, stores all the time entries in a Retool database, and then sends a reformatted time entry to a Microsoft Outlook calendar as an appointment. Currently I am stuck on the first step, which is populating a database in Retool.

  • Steps: I have tried this 15 ways to sunday but can't get the API call to populate the database. I think I need to somehow manually map the API variable to the database column variable but I don't understand how to complete this. I am also quite unsure if I should use a Bulk Upsert, or "Update a Record or Create a New Record if it Doesn't Exist"

If anyone has any tips, or a different process I should try to follow, please help me out! I am trying hard to learn but i am new and this is painful. :slight_smile:

1 Like

i think you just need to use the result of code3 in the query2 block. in the Array of records to update field try putting {{ code3.data }}, which should update the at2 table with your 2d array [["QueryId", 1], ["startTime", "2022-01-01T08:00:00"], [stuff i can't see]] or {{ code3.data[0] }} to update the table with just ["QueryId", 1].

you might also run into an issue with it expecting an array of objects, not an array of arrays. if so try using [{{ formatDataAsObject(code3.data) }}] which should turn your array of arrays into an array of objects.

{
  QueryId: 1,
  startTime: 2022-01-01T08:00:00,
  array3Key: array3Value
}

Hi Bobthebear!! Thanks so much for the assist.

I attempted putting {{ code3.data }} in my Array of Records to Update but I get an unprocessable error:

In terms of your suggestion of [{{ formatDataAsObject(code3.data) }}] - is this to append or replace in my code3 node? I am unsure how I should add this code into the mix here. If i add it in to my Query2 i get another Data Array error:

or

Thanks for your thoughts! I really appreciate your help.