Process question - api updating database

Hi,
this is more a question regarding the process/workflow.

Im using a api to create things in the database or to update an existing thing if a specific id is already existing.

But here it comes:
What’s about data that are not longer available via api? I.g. Because something were deleted on the external endpoint.

In my current workflow it will still exist in my database. But not longer be updated.

But I want to delete this thing in my database too if it was deleted on the external endpoint.

Any idea? My first thought was using the modification date in the database. But this will only be updated if there is any change. If there is no change for this item the date will not be updated.

Any idea?

Call the external service periodically for things that have not been updated in … 12 months? … and check for the thing’s ID

mmh no - that won’t work as I need those data to be removed on a monthly base - right at the time when my user hits the “refresh data” button.

any other idea?

Do you go through each record when fetching the data of that external API? If so, then just always update the thing in Bubble with a last modified date. Then delete all records in the bubble DB which have a last modified date older than the start date of your sync process.

Edit: Keep in mind that Bubble has a built-in field ‘Modified Date’.

1 Like

The issue is that this field will not be update when there is no change :frowning:

Then create a new field of type date which you always update with the current date :slight_smile:

1 Like

Could you just delete first then refetch so if it exists it will be created?

that is an great idea.
Do you have an idea how to do this for a csv import? :wink: