Loading...
Area: Optimizely Content Delivery API
Applies to versions: 2 and higher
Other versions:

Installing Content Delivery API

Recommended reading 

The Optimizely Content Delivery API is installed through a set of NuGet packages, depending on the scenario in which the headless API will be used. 

In this topic

Installation procedure

Install the NuGet packages in your solution using the NuGet Package Manager in Visual Studio or via command line:

Install-Package EPiServer.ContentDeliveryApi

See the general Installing Optimizely instructions for more detailed information on setting up Visual Studio, requirements, etc.

Installation packages

Optimizely Content Delivery API consists one main NuGet package, EPiServer.ContentDeliveryApi.Core, and a number of additional NuGet packages, allowing you as a developer to install only the functionality you need. These are the additional packages:

  • EPiServer.ContentDeliveryApi
    This is a wrapper package that lets you quickly install the packages needed for a headless CMS (that is, EPiServer.ContentDeliveryApi.Core, EPiServer.ContentDeliveryApi.Cms, and EPiServer.ContentDeliveryApi.OAuth).
  • EPiServer.ContentDeliveryApi.Cms
    You can install just this package if you only need to deliver content using frameworks like React or Vue, without authentication or search capabilities in the API.
  • EPiServer.ContentDeliveryApi.OAuth
    Install this package if you need OAuth authentication.
  • EPiServer.ContentDeliveryApi.Search
    Install this package if you need search capabilities in the API. Note that search requires an Optimizely Search & Navigation installation and licence. If you do not already have a licence for Search & Navigation, you can get one at the Optimizely Marketplace. (Licences for demo purposes can be found at Optimizely Search & Navigation - Developer Demo Services/).

Different scenarios

Depending on specific scenarios, one or several packages can be installed. For example:

  • Same domain and frameworks like React
    If the Content Delivery API runs on the same domain and in the same server context as the regular site, and the purpose is to use it along with frameworks like React or Vue to build the front-end, install the EPiServer.ContentDeliveryApi.Cms package.

    For this scenario, Content Delivery API can work well with cookie-based authentication (for example, using the default login form of the Alloy site), so there is no need to install the EPiServer.ContentDeliveryApi.OAuth package for token-based authentication and authorization. 
  • Search capabilities needed
    If searching functionalities should be enhanced within the site, install the EPiServer.ContentDeliveryApi.Search package. This package basically connects the site to Optimizely Search & Navigation through endpoints.
  • Front-end mobile platforms
    If the purpose is to build front-end on mobile platforms, install the EPiServer.ContentDeliveryApi package. This wrapper package installs the EPiServer.ContentDeliveryApi.Core, EPiServer.ContentDeliveryApi.Cms, and EPiServer.ContentDeliveryApi.OAuth packages for you.
    The ContentDeliveryApi.OAuth package provides an endpoint to obtain token and later on, this token is used for authentication and authorization for requests acquiring resources.

Dependencies

The Content Delivery API contains five NuGet packages:

  • EPiServer.ContentDeliveryApi.Core. Contains base classes, interfaces, and services for data manipulation.
    1.core.jpg
  • EPiServer.ContentDeliveryApi.Cms. Depends on EPiServer.ContentDeliveryApi.Core. The package contains API endpoints to retrieve content created in Optimizely CMS.
    2.cms.jpg
  • EPiServer.ContentDeliveryApi.OAuth. This is a standalone package that enables OAuth 2.0 token-based authentication and authorization.
    3.OAuth.jpg
  • EPiServer.ContentDeliveryApi. This package depends on EPiServer.ContentDeliveryApi.Core, EPiServer.ContentDeliveryApi.Cms, and EPiServer.ContentDeliveryApi.OAuth.
    4.ContentDeliveryApi.jpg
  • EPiServer.ContentDeliveryApi.Search. Contains API endpoints for data searching with Optimizely Search & Navigation. The package depends on EpiServer.Find and EPiServer.ContentDeliveryApi.Core.
    5.Search.jpg

Upgrading from version 1.x

Follow these steps to upgrade the Content Delivery API, if the site has installed versions 1.0.0 or 1.0.1:

  • If you want to use the default OAuth of the Content Delivery API, upgrade your site to EPiServer.ContentDeliveryApi 2.x.
  • If you do not need the default OAuth, first uninstall the package EPiServer.ContentDeliveryApi 1.x, and then, install the package EPiServer.ContentDeliveryApi.Cms 2.x.
  • If the site previously used EPiServer.ContentDeliveryApi.Search, this package should be re-installed using version 2.x.  
Do you find this information helpful? Please log in to provide feedback.

Last updated: Nov 08, 2018

Recommended reading