I know I could use petapoco to fetch external sql data into a view using razor, but what if I wanted to fetch documents from another Umbraco database - eg if we have a central site that has information common to multiple other sites , such as office contact details, could we pull these into each site using razor in a partial view?
Certainly - you could create your own UmbracoApiController (link) to return the content you need. That might be easiest but there are also RESTful APIs available.
Make sure you cache the data and don't call the API for each request; otherwise Ouch!
Is there any documentation on the UmbracoRestApi - not how to install, but actually how to make use of it. Do I have to write new controllers in Visual Studio in the Umbraco application?
Could it be used via web services?
Applogies for stupid question, but not quite clear where this all fits in.
Fetching data from documents in another instance
I know I could use petapoco to fetch external sql data into a view using razor, but what if I wanted to fetch documents from another Umbraco database - eg if we have a central site that has information common to multiple other sites , such as office contact details, could we pull these into each site using razor in a partial view?
Thanks
Certainly - you could create your own
UmbracoApiController
(link) to return the content you need. That might be easiest but there are also RESTful APIs available.Make sure you cache the data and don't call the API for each request; otherwise Ouch!
Looks interesting - I shall read this...
Thanks
Another option is the UmbracoRestApi, if you love pure REST and need to update documents.
Is there any documentation on the UmbracoRestApi - not how to install, but actually how to make use of it. Do I have to write new controllers in Visual Studio in the Umbraco application?
Could it be used via web services?
Applogies for stupid question, but not quite clear where this all fits in.
Thanks
You might well be able to use it via a service reference yes. I've not tried it though. This extract from the article might be of use:
Discovery
A great way to browse Umbraco's REST service is to use the great html/javascript HAL Browser. The starting endpoints are:
We will be enabling a single root endpoint that list these HAL links in the very near future!
Will look at that. Thanks
is working on a reply...