I have a headless install with two languages. If I call an API endpoint, which extends UmbracoApiController, I only get back content in the default language. What's the best practice to get either all language variants or a specified language variant back?
Just looking into the same thing myself. Many of the Umbraco functions have a culture parameter. e.g.
var title = node.Value("title", "it");
var italianChildren = node.DescendantsOfType("blogEntry", "it");
So, you need to update your controller to use this parameter. The culture is the ISO code (lower case), you can see that in Languages (under Settings).
Culture specific content from webApi call
Umb 8.12.2
Hi,
I have a headless install with two languages. If I call an API endpoint, which extends UmbracoApiController, I only get back content in the default language. What's the best practice to get either all language variants or a specified language variant back?
Thnx
Hi Craig,
Just looking into the same thing myself. Many of the Umbraco functions have a culture parameter. e.g.
So, you need to update your controller to use this parameter. The culture is the ISO code (lower case), you can see that in Languages (under Settings).
Stuart.
I suggest you supply the locale in a header, or just in the path, and then set
Thread.CurrentUICulture
to the locale in question.The answer is here:- https://our.umbraco.com/documentation/Reference/Language-Variation/
Link provided by Jesper on the Umbraco Slack channel.
So I can do things like https://mydomain.com/umbraco/api/getMyThings?culture=fr
Works like a charm.
is working on a reply...