Copied to clipboard

Flag this post as spam?

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


  • Jeffrey Weinstein 67 posts 313 karma points
    Oct 15, 2022 @ 22:25
    Jeffrey Weinstein
    0

    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?

  • Roy Berris 89 posts 578 karma points c-trib
    Oct 17, 2022 @ 06:59
    Roy Berris
    100

    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/)

  • Jeffrey Weinstein 67 posts 313 karma points
    Oct 17, 2022 @ 16:50
    Jeffrey Weinstein
    1

    That's terrific advice, thanks!

    I found good controllers summarization also here - https://www.youtube.com/watch?v=h81mb3stzaM

  • 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