Hello everyone,
I’ve set an API call that returns a JSON with many items. Each item has a unique ID, Start time and other values.
The backend workflow runs on all the items and saves them one by one to the database.
(like in this video)
The problem is that if I call the API twice, it saves all the data and not only the new items.
- How can I add a rule that allows adding the items to the database, only if the item’s ID doesn’t exist in the data base?
In the backend workflow when you are creating a new thing. Add a conditional on that action to only create a new thing if Do a search for thing where the field storing the id = the current workflow items id :first item is empty. Then add a make changes to thing and put the same conditional but change the end to say :first item is not empty
Hi @williamtisdale
Thanks for replying, but I’m not sure what exactly you mean.
I added the “when” condition for the add new thing, but why do I need to use the make changes part?
You only need to add the Make Changes Action if the data you are pulling from the API will have different values over time. For example if you were pulling stock info you would always want to update the current stock price. This may not be your case if the values are constant.
Got ya, fair point!
Thanks so in that case, the problem is solved.
Appreciate your help buddy!