Copied to clipboard

Flag this post as spam?

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


  • Nguyen Dung Tri 106 posts 606 karma points
    Aug 08, 2016 @ 14:19
    Nguyen Dung Tri
    1

    How to get Umbraco API URL?

    Hello,

    I would like to get the Umbraco API URL. How can I do that in C# or javascript?

    Currently, I have an API URL like this:

    http://localhost:62195/umbraco/api/Elmanagement/GetAllEmployees
    

    So on front-end, how can I get the api url when I only know a part of My API Controller:

    /api/Elmanagement/GetAllEmployees
    

    The extant part of API URL is hard to get if the port is change, or site uploaded onto other domain etc....

    Like this:

    http://mydomain/umbraco/api/Elmanagement/GetAllEmployees
    

    or

    http://mybusinessdomain/umbraco/api/Elmanagement/GetAllEmployees
    

    So the part of Umbraco back office url is always changeable. So is there a way to get the back-office url of Umbraco?

  • Alex Skrypnyk 6182 posts 24283 karma points MVP 8x admin c-trib
    Aug 08, 2016 @ 14:35
    Alex Skrypnyk
    100

    Hi Nguyen,

    Are you using UmbracoApiController?

    All locally declared Umbraco api controllers will be routed under the url path of:

    ~/Umbraco/Api/[YourControllerName]

    E.g ~/Umbraco/Api/Products/GetAllProducts

    Read more - https://our.umbraco.org/documentation/reference/routing/webapi/

    Thanks,

    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