I have a system which creates content outside of Umbraco and everytime user saved the change there I want to push it to Umbraco, I figured I would add extra controller to Umbraco and via content service I would push the content, could someone please help me with routing and setting up a controller for this?
Posting content into umbraco
I have a system which creates content outside of Umbraco and everytime user saved the change there I want to push it to Umbraco, I figured I would add extra controller to Umbraco and via content service I would push the content, could someone please help me with routing and setting up a controller for this?
Hi,
You can create a new controller (UmbracoAuthorizedApiController). See: https://our.umbraco.com/documentation/reference/routing/Authorized/
Now your endpoint will start with
/umbraco/api/{controllername}/{actions}
.In this controller you can inject the
IContentService
, and do your things.That's it really.
If the umbraco authorization does not suit your needs. You can always add your own authorization, for example use basic authentication.
(I have never used this, but to my understanding you can communicate server-to-server with these settings: https://our.umbraco.com/documentation/Reference/Configuration/BasicAuthSettings/)
That's terrific advice, thanks!
I found good controllers summarization also here - https://www.youtube.com/watch?v=h81mb3stzaM
is working on a reply...