What is layout service testing?

The Layout Service is what powers Sitecore JSS and provides the data about a given URL/page request in the form of a JSON object. If you've heard of the Sitecore Web API before, this is rather similar in execution, if more specialised in scope.

19 Aug 2020

Technology

1

min read

Garrad Stacey

,

Back-end Developer

illustration of layoutr
illustration of layoutr
illustration of layoutr

Generally speaking, we would never actively call the Layout Service directly, but sometimes it's good for testing purposes to be able to get a raw data dump to ensure data is actually being given in the correct format (or at all) before looking elsewhere.

How to use it for testing

The endpoint that powers the layout service sits at the URL of: {siteName}/sitecore/api/layout/render/jss

This requires two additional pieces of information in query string form to supply data:

  1. The path of the item requested. For example a sitecore/content/home/sample would use the path /sample

  2. The GUID of the API key. This is a value that is configured in Sitecore when first setting up JSS

With these in mind, the URL to request the data can be built like this, {sitename}/sitecore/api/layout/render/jss/?item=sample&sc_apikey={00000000-0000-0000-0000-000000000000}

Working with Codehouse

At Codehouse we continually work on exciting design and build Sitecore projects. Our development team use best practices to build robust and engaging Sitecore websites. Get in touch to find out more.

Yes, please sign me up for a demo of this in action

Digital Playbook

Haven't subscribed to our digital-first playbook yet?

Digital Playbook

Haven't subscribed to our digital-first playbook yet?

Digital Playbook

Haven't subscribed to our digital-first playbook yet?

Digital Playbook

Haven't subscribed to our digital-first playbook yet?

Talk to us about your requirements

Codehouse acknowledges the Traditional Owners of Country throughout Australia. We pay our respects to Elders past and present.

©2023 All rights reserved, Codehouse

Talk to us about your requirements

Codehouse acknowledges the Traditional Owners of Country throughout Australia. We pay our respects to Elders past and present.

©2023 All rights reserved, Codehouse

Talk to us about your requirements

Codehouse acknowledges the Traditional Owners of Country throughout Australia. We pay our respects to Elders past and present.

©2023 All rights reserved, Codehouse

Talk to us about your requirements

Codehouse acknowledges the Traditional Owners of Country throughout Australia. We pay our respects to Elders past and present.

©2023 All rights reserved, Codehouse