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.

Aug 19, 2020

Technology

1

min read

Garrad Stacey

,

Back-end Developer

illustration of layoutr
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.

More articles by this author: Introduction to Unicorn

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.

More articles by this author: Introduction to Unicorn

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.

More articles by this author: Introduction to Unicorn

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.

More articles by this author: Introduction to Unicorn

THE EXPERIENCE ENGINE

Personalise your site in 20 days! No Roadblocks. No Upgrades. MVP Driven.

THE EXPERIENCE ENGINE

Personalise your site in 20 days! No Roadblocks. No Upgrades. MVP Driven.

THE EXPERIENCE ENGINE

Personalise your site in 20 days! No Roadblocks. No Upgrades. MVP Driven.

Talk to us about your challenges, dreams, and ambitions

X social media icon

Talk to us about your challenges, dreams, and ambitions

X social media icon

Talk to us about your challenges, dreams, and ambitions

X social media icon

Talk to us about your challenges, dreams, and ambitions

X social media icon