Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi
I'm trying to get a node by its url or path. Before v8 you could do it by uQuery.GetNodeIdByUrl("/"); but now I can't find the equivalent method.
uQuery.GetNodeIdByUrl("/");
I'm trying to call it inside af Umbraco Web API if that makes any difference :)
/Peter
Hi Peter
There is the GetByRoute method in 'IPublishedContentCache'
https://github.com/umbraco/Umbraco-CMS/blob/853087a75044b814df458457dc9a1f778cc89749/src/Umbraco.Web/PublishedCache/IPublishedContentCache.cs#L34
So wondering if somethign like this would work in your APIController?
IPublishedContent matchingRouteContentItem = UmbracoContext.ContentCache.GetByRoute("/",false);
regards
Marc
Hi Mark
Thank you. That was exactly was I was looking for :)
But in my case second parameter should be true, else I can't find subpages.
This should now be
IPublishedContent matchingRouteContentItem = UmbracoContext.Content.GetByRoute("/",false);
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
uQuery.GetNodeIdByUrl() in Umbraco 8
Hi
I'm trying to get a node by its url or path. Before v8 you could do it by
uQuery.GetNodeIdByUrl("/");
but now I can't find the equivalent method.I'm trying to call it inside af Umbraco Web API if that makes any difference :)
/Peter
Hi Peter
There is the GetByRoute method in 'IPublishedContentCache'
https://github.com/umbraco/Umbraco-CMS/blob/853087a75044b814df458457dc9a1f778cc89749/src/Umbraco.Web/PublishedCache/IPublishedContentCache.cs#L34
So wondering if somethign like this would work in your APIController?
regards
Marc
Hi Mark
Thank you. That was exactly was I was looking for :)
But in my case second parameter should be true, else I can't find subpages.
/Peter
This should now be
is working on a reply...