I have the following scenario. I want to use external API for getting information about hotels. For every hotel that I get from the API I have custom properties in Umbraco (example different picture and description cause I don't like the ones from the API ). I still need to use the API though to get the availability of the hotel rooms in real time. So for example If a have 50 hotel results from the API call I then want to add these custom properties from Umbraco content to each one of them before sending them as a response to frontend. How do you propose to implement this with most optimization?
One way you could do it would be to write your own WebApiController that retrieves the external hotel details, then does a lookup in Umbraco for the custom properties. Once the details have been retrieved you can pass them on to the client.
Alternatively, the client could call your own WebApi to augment the hotel details from Umbraco content (perhaps even the Umbraco REST Api may be enough here) and then aggregate the results before displaying them?
Merging API results with Umbraco content
Hi all,
I have the following scenario. I want to use external API for getting information about hotels. For every hotel that I get from the API I have custom properties in Umbraco (example different picture and description cause I don't like the ones from the API ). I still need to use the API though to get the availability of the hotel rooms in real time. So for example If a have 50 hotel results from the API call I then want to add these custom properties from Umbraco content to each one of them before sending them as a response to frontend. How do you propose to implement this with most optimization?
My advice, do not use Umbraco content for external data. Create a table in the database, custom route, and virtual node.
https://our.umbraco.org/documentation/reference/routing/custom-routes
http://jamessouth.me/archive/fun-with-umbracovirtualnoderoutehandler/
https://stackoverflow.com/questions/35647220/how-to-create-a-virtual-node-in-umbraco
One way you could do it would be to write your own WebApiController that retrieves the external hotel details, then does a lookup in Umbraco for the custom properties. Once the details have been retrieved you can pass them on to the client.
Alternatively, the client could call your own WebApi to augment the hotel details from Umbraco content (perhaps even the Umbraco REST Api may be enough here) and then aggregate the results before displaying them?
is working on a reply...