Copied to clipboard

Flag this post as spam?

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


  • Gerard 5 posts 75 karma points
    May 04, 2017 @ 11:33
    Gerard
    0

    WebApi communication with Umbraco

    Hi all,

    I am rather new to setting up Umbraco projects so i could use some advice. Basically I have an existing WebApi with its own database etc. and I want this WebApi to fetch content from an Umbraco instance. Is this possible and if so, how?

    I guess the api would need the UmbracoCms.Core package? I tried installing that but I can't get it to work as I get issues with conflicting dependency versions. The api for example uses AutoMapper 5.1.1 and Newtonsoft.Json 6.0.4 whereas UmbracoCms.Core requires AutoMapper 3.3.1 and Newtonsoft.Json 10.0.2.

    Am i doing something wrong? Any help would be appreciated, thank you!

  • ianhoughton 241 posts 490 karma points c-trib
    May 04, 2017 @ 15:44
    ianhoughton
    0

    Hi Gerard,

    You need to think of this the other way around. Create an Umbraco WebApi controller that sits inside the Umbraco instance. This controller then has access to Umbraco content / services etc, and can send out data to your other service.

    https://our.umbraco.org/documentation/reference/routing/webapi/

    Cheers Ian

  • Gerard 5 posts 75 karma points
    May 04, 2017 @ 16:53
    Gerard
    0

    Thanks for the reply. But let's say I have an endpoint in the existing WebApi and this endpoint should return some data from its database and also the title of a node in Umbraco (for example). This won't be possible with this setup right, unless I would make a http request from the existing WebApi to the WebApi in the Umbraco instance? Am i missing something?

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    May 04, 2017 @ 17:02
    Alex Skrypnyk
    0

    Hi Gerard

    Yes, you are right, it's one of the possible solutions to the current situation - wrap all calls from Umbraco to UmbracoApiControllers and use it externally.

    Thanks,

    Alex

  • Gerard 5 posts 75 karma points
    May 05, 2017 @ 13:00
    Gerard
    0

    Hi Alex,

    Are you referring to the solution of making an http request from the existing WebApi to the Umbraco api? That doesn't sound like an optimal solution, isn't there a better way to do it?

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    May 07, 2017 @ 20:26
    Alex Skrypnyk
    0

    Hi Gerard

    I would suggest you use Umbraco REST API - https://github.com/umbraco/UmbracoRestApi, it's great library exactly for your situation.

    You need just to make API on your side and connect to Umbraco REST API

    Thanks,

    Alex

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    May 15, 2017 @ 14:30
    Alex Skrypnyk
    0

    Hi Gerard

    Can you share please how did you do it?

    Alex

  • Gerard 5 posts 75 karma points
    Jun 28, 2017 @ 12:14
    Gerard
    0

    Sorry for the (very) late reply, but I just made a Umbraco Api using the UmbracoApiController solution and then make calls from the existing webapi to this Umbraco Api. Works fine!

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    Jun 29, 2017 @ 07:36
    Alex Skrypnyk
    0

    Hi Gerard

    Thank you for sharing, nice solution!

    Alex

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies