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 example.com/en/home and anotherdomain.com/en/home. Content this pages is not the same.
If i set this url to parameter in function UmbracoApiController then I always getnull or error.
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.
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.
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).
Get content by URL
Hi,
I look for how to get content (ideal from cache) by URL with multiple hostnames in custom API controller
UmbracoApiController
. I was find methodUmbracoContext.Content.GetByRoute
but I don't know how to get content for specific hostname / domain.For example, how find content for
example.com/en/home
andanotherdomain.com/en/home
. Content this pages is not the same.If i set this url to parameter in function
UmbracoApiController
then I always getnull
or error.Thanks.
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.
https://github.com/TimGeyssens/UmbracoPageNotFoundManager/blob/master/PageNotFoundManager/PageNotFoundContentFinder.cs
Hope that helps steer in the right direction.
regards
marc
This doesn't seem to work inside a LastChanceContentFinder
Hi Damien
What problem is occurring?
There is a V8 version of the UmbracoPageNotFoundManager, that has an example of GetByRoute:
https://github.com/TimGeyssens/UmbracoPageNotFoundManager/blob/dev-v8/PageNotFoundManager/PageNotFoundContentFinder.cs
That is registered as a LastChanceContentFinder
https://github.com/TimGeyssens/UmbracoPageNotFoundManager/blob/dev-v8/PageNotFoundManager/PageNotFoundManagerComposer.cs#L18
that it might be helpful to compare with.
regards
Marc
??
@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.
Cheers,
- Lee
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
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
is working on a reply...