Copied to clipboard

Flag this post as spam?

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

  • Jojo V 64 posts 166 karma points
    Jul 18, 2019 @ 08:45
    Jojo V

    Get content by URL


    I look for how to get content (ideal from cache) by URL with multiple hostnames in custom API controller UmbracoApiController. I was find method UmbracoContext.Content.GetByRoute but I don't know how to get content for specific hostname / domain.

    For example, how find content for and Content this pages is not the same.

    If i set this url to parameter in function UmbracoApiController then I always getnull or error.


  • Marc Goodson 2149 posts 14355 karma points MVP 9x c-trib
    Jul 20, 2019 @ 23:53
    Marc Goodson

    Hi Jojo

    If you have specific multiple custom hostnames set on your Umbraco site to different root nodes in the content tree - then you can still use GetByRoute..

    but you need to prefix the relative path you are looking for with the id of the Root node for that site domain..

    So GetByRoute("1234/en/home") and GetByRoute("1235/en/home")

    where 1234 is the id of root node for one site, and 1235 is the root node for another...

    I know this is a V7 package PageNotFoundManager by TimGeyssens, but this code gives you a bit of a gist of how the GetByRoute works in a multi site Umbraco implementation.

    Hope that helps steer in the right direction.



  • Damien Holley 180 posts 541 karma points
    Nov 16, 2020 @ 04:21
    Damien Holley

    This doesn't seem to work inside a LastChanceContentFinder

  • Marc Goodson 2149 posts 14355 karma points MVP 9x c-trib
    Nov 16, 2020 @ 19:22
    Marc Goodson

    Hi Damien

    What problem is occurring?

    There is a V8 version of the UmbracoPageNotFoundManager, that has an example of GetByRoute:

    That is registered as a LastChanceContentFinder

    that it might be helpful to compare with.



  • Jojo V 64 posts 166 karma points
    Jan 04, 2021 @ 07:24
    Jojo V


  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Jan 04, 2021 @ 09:11
    Lee Kelleher

    @Jojo, the comment you replied to appears to be spam, I've flagged it as such (hence it's removed from this thread). Frustrating, I know.

    - Lee

  • Heathcote 1 post 71 karma points
    Jan 04, 2021 @ 09:43

    When I use following URL in browser then it prompt me to download a text file with JSOn content.

    Now I want to create a php page. I want that when I call this php page, it should call above URL and get content(json format) from file and show it on screen.

    How can I do this ??

    MyFordBenefits Login

  • Jojo V 64 posts 166 karma points
    Jan 04, 2021 @ 09:58
    Jojo V

    If you are prompted to download a JSON file, your browser has incorrect settings (default is to display JSON content)

    In PHP, you can simply call "$result = filegetcontents ('UMBAPIURL')". In the variable $result you will have the content of JSON from the UMB API. You can use the PHP function "json_decode()" to decode JSON to an object. Alternatively, use functions / libraries other than cUrl ...

    (I'm also a PHP programmer)

    I just don't understand what this has to do with this post (this is .Net technology).

    PS: You must first have the UMB API programmed

Please Sign in or register to post replies

Write your reply to: