Hi everyone,
I’m building a web app that pulls car listings from a car dealer API. Users input a dealer’s business name, and the app fetches all vehicles they have for sale starting from that day. The API updates every 24 hours to check for sold cars or newly added listings. The initial data retrieval and display are working fine, but I’m facing an issue with how to handle updates and compare new data. to avoid creating duplicate records in the database.
Here’s the situation:
- Each day, the API fetches a list of cars from a dealer and I need to check if each car is already in the database.
- If a car is no longer available or has been sold, I need to mark it as sold or remove it from the active list.
- If new cars are added, I need to insert them into the database.
My question is: Should I create duplicate records for cars each time the API updates (e.g., creating a new record for every update) or should I do it differently?What’s the best way to do it efficiently in Bubble?
Some additional questions:
How do I compare the new data with existing listings (e.g., comparing by unique identifiers or other fields)?
What’s the best way to flag or remove listings that are no longer available?
Is it better to keep a historical record of cars (e.g., archived cars) or just update the active listings?
Any tips on handling this efficiently, especially when the dataset grows over time?
Looking forward to your suggestions!