Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tim C 146 posts 502 karma points
    Aug 25, 2016 @ 10:48
    Tim C
    0

    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

  • David Peck 587 posts 1554 karma points c-trib
    Aug 25, 2016 @ 10:53
    David Peck
    100

    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!

  • Tim C 146 posts 502 karma points
    Aug 25, 2016 @ 10:54
    Tim C
    0

    Looks interesting - I shall read this...

    Thanks

  • Damiaan 434 posts 1279 karma points MVP 2x c-trib
    Aug 25, 2016 @ 12:57
    Damiaan
    0

    Another option is the UmbracoRestApi, if you love pure REST and need to update documents.

  • Tim C 146 posts 502 karma points
    Aug 25, 2016 @ 13:04
    Tim C
    0

    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

  • David Peck 587 posts 1554 karma points c-trib
    Aug 25, 2016 @ 13:12
    David Peck
    0

    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:

    • /umbraco/rest/v1/content /umbraco/rest/v1/media
    • /umbraco/rest/v1/members /umbraco/rest/v1/relations

    We will be enabling a single root endpoint that list these HAL links in the very near future!

  • Tim C 146 posts 502 karma points
    Aug 25, 2016 @ 13:13
    Tim C
    0

    Will look at that. Thanks

Please Sign in or register to post replies

Write your reply to:

Draft