Last active
September 29, 2022 13:20
-
-
Save trnktms/4c078509148c027e69c995a3744d8823 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Net; | |
using System.Web.Mvc; | |
using Foundation.ContentsResolvers; | |
using Sitecore; | |
using Sitecore.LayoutService.Configuration; | |
namespace Feature.Controllers | |
{ | |
public class CustomApiController : BaseApiController | |
{ | |
public CustomApiController( | |
IDefaultRenderingContentsResolver defaultRenderingContentsResolver, | |
IConfiguration configuration) | |
: base(renderingConfigFactory, defaultRenderingContentsResolver, configuration) | |
{ | |
} | |
[HttpGet] | |
public ActionResult Organizations() | |
{ | |
var item = Context.Database.GetItem("/your/test/item/path"); | |
var jsonResult = defaultRenderingContentsResolver.ProcessItem(i, renderingConfiguration) | |
return Content(jsonResult.ToString(), "application/json"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment