HomeGuidesAPI ReferenceGraphQL
Submit Documentation FeedbackJoin Developer CommunityOptimizely GitHubOptimizely NuGetLog In

Headless Optimizely

This topic describes using the Content Delivery API to build a headless Optimizely solution.

Optimizely headless solution

In a headless solution, the website presentation layer is decoupled from the back-end content management and e-commerce functionality. This is useful, for example, when pulling content data into other systems, making it accessible for display on any output device.

The Optimizely Content Delivery API is a flexible and unified API for content delivery across all types of managed content. It supports Optimizely Content Management System (CMS) content types, and Optimizely Customized Commerce content types like catalog nodes, products, variants, and pricing.

The Content Delivery API also supports rendering of forms built with Optimizely Forms, for example, in single-page application sites built with React or Vue.

For samples sites and source code, see the Content Delivery JS SDK repository repository on GitHub.

Cloudflare headless page rules

Cloudflare does not automatically cache .json results. Rules allow responses from endpoints in ContentDeliveryApi (CD) & ContentDeliveryApi.Search (CD.Search) to be cached for clients. The pattern covers all endpoints in CD. The pattern for those new rules is narrowed down in scope so that they only cover endpoints in CD and CD.Search.

•   *{domain}/api/episerver/*/content*: is intended to capture and cache response data from CD and the patterns cover mostly all endpoints  in CD like content data, content’s children, and content’s ancestors, get list of contents.
•   *{domain}/api/episerver/*/site* : is intended to capture and cache response data from endpoints to return site data
•   *{domain}/api/episerver/*/search/content*: : is intended to capture and cache response data from endpoints to search content data.

Clients may use accept-language in their request for content, so the page rule should also consider language.