I would like to insert some data I get from 3rd party API to the get response of a list and a single item, what is the best way to do it?
Create custom API service from business logic or there is an easier way for it?
Let’s have an example, I have list of cities stored in Backandless and when I query this list I would like to include weather/temperature in the response for each city instead of making N requests on the client.
There are two approaches to accomplish what you want:
Using an event handler
Using an API service
The first approach would be simpler (IMHO) since you’d be getting a collection of retrieved objects and can enrich it in your code/logic. With the second approach, you’d need to fetch objects and then enrich each of them.
Will you be using Codeless or code to implement this?
I would use code I think. I was thinking to go with event handler, but I do not see a handler for get operation. Only for find or first which is only for one item, can you point me to a handler when you get all the items from the table, please? Thanks!
Once the handler is created, you can edit the code right in the console. The arrow in the screenshot below points to the object that will have the collection objects you need to enrich: