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!
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.
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?
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.
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?
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!
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!
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
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?
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
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?
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
Hi Gerard
Can you share please how did you do it?
Alex
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!
Hi Gerard
Thank you for sharing, nice solution!
Alex
is working on a reply...