Get started with Sitecore Experience Edge For XM — Part 2

SitecoreHandbook
4 min readJun 14, 2022

In Part one of my blog post on Experience Edge we’ve looked at what is sitecore Experience edge delivery platform and how business can utilise this product for JSS sites on sitecore XM . In part 2 of this blog lets deep dive into technical aspects of how to set up edge API’s for local development & production

The plaform provides the following API’s consumption

  • Preview API : A GraphQL API exposing a preview of your unpublished content. This API endpoint should be used for your local development , UI testing and testing your queries
  • Delivery API : A GraphQL API exposing your published content. Use this API for all production-related actions.
  • Token API : A REST API used for retrieving and managing API keys needed for accessing the preview and delivery APIs.
  • Admin API : A REST API used to change Cache , Content , Webhook & delivery platform related settings

Setting up self hosted edge endpoint for Local development

  1. The first step is to download the Experience Edge connector module from here for your topology ,The module is also avaiblale as docker images if you are working with containers — scr.sitecore.com/sxp/modules/sitecore-headless-services-[topology]-assets:20.0-[windows-version]
  2. The installed module includes a GraphQL endpoint that mirrors the schema and behavior of Experience Edge, based on the Sitecore GraphQL API. This enables preview, editing, and local development without publishing to Experience Edge.
  3. Create an API key similar to the way you would create for your jss application — Create a an item of type sitecore\templates\System\Services\API Key template under master\sitecore\system\Settings\Services\API Keys ,

For local development , set CORS as * , Allowed controllers as * & impersonation user as extranet anonymous

The Item ID is to be used as the API Key (Long or short) in yoru queries

sc_apikey = 63AC214E-08CD-49A0–9668-E57928F0CABD

or

sc_apikey = 63AC214E08CD49A09668-E57928F0CABD

4. While working with headless services (jss, .netcore rendering) CD instances would server content from {cd_domain}/api/layout/render/jss,With Experience Edge for XM , Sitecore has defined a new preview edge endpoint /sitecore/api/graph/edge and read-only GraphQL schema to facilitate local development . The configuration can be found at /App_Config\Sitecore\Services.GraphQl\Sitecore.Services.GraphQL.EdgeContent.config

5. The query endpoint has been set up https://{domain}/sitecore/api/graph/edge?sc_apikey={63AC214E-08CD-49A0–9668-E57928F0CABD}

6. You can now start querying edge Schema by using any graphQL client you are familar with

Setting up Edge API’s for Production

  1. Obtain client_id and client_secret from you sitecore sales point of contact
  2. Install Experience Edge connector module on you CM instance
  3. Patch a new connection string entry to your connectionstrings config

4. patch the content publishing endpoint provided to you by creating a patch file to pp_Config\Modules\ExperienceEdgeConnector\ExperienceEdgeConnector.config

5. With the two Patch files , you are good to publish content from your sitecore instance to Experience Edge platform

By default , experience edge connector is configured to publish to the web target , When you publish to web , the content will be published to the Edge as well

With Edge set up and content published to Edge , In Part 3 of this series lets look how to use Edge API’s for querying and administering your Edge Tenant

--

--