Skip to content

Instantly share code, notes, and snippets.

@himadric
Created February 26, 2019 01:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save himadric/1fbe7498194f8c4cdc399ae47573caa7 to your computer and use it in GitHub Desktop.
Save himadric/1fbe7498194f8c4cdc399ae47573caa7 to your computer and use it in GitHub Desktop.
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
namespace SitecoreApi
{
[Route("sitecorelayout")]
[Authorize]
public class SitecoreLayoutController : ControllerBase
{
public async Task<IActionResult> Get()
{
var client = new HttpClient();
var content = await client.GetStringAsync("http://sitecore910.sitecore/sitecore/api/layout/render/jss?item=/&sc_apikey={9B8A0FCF-BA5A-483E-9AB0-E263866B9EAF}");
return new JsonResult(JsonConvert.DeserializeObject(content));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment