1

In Sitecore 10.2 (Using .Net Core rendering SDK), is there any altervative way to call Layout API apart from below example.

    public class DefaultController : Controller 
    { 
      [UseSitecoreRendering] 
      public IActionResult Index(Route route) 
      { 
        return View(route); 
      } 
    }

I want to call Layout API and populate route object instead of Middleware filter as shown above so that I can modify request param for Layout API.

1 Answer 1

1

Update rendering engine with a query parameter in configure services

services.AddSitecoreRenderingEngine(options =>
            {
                //Register your components here
                options
                .MapToRequest(
                      (httpRequest, sitecoreLayoutRequest) => sitecoreLayoutRequest.Language(**httpRequest.Query["lang"]**));
            })

Then call API with passing lang in query string https://HostingAPI/APIEndpoints?lang=en-au

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.