Try our conversational search powered by Generative AI!

David Buö
Nov 21, 2018
(5 votes)

Get started with Content Delivery API 2.2.0

I just installed the latest version of Episerver Content Delivery API 2.2.0 and  just wanted to share some quick findings in order for you guys to get it up and running quickly.

I started by installing the following packages in visual studio, Episerver.ContentDeliveryApi.Search is optional and requires Episerver Find. Installation on to the latest Alloy went smooth and without dependency/build errors.


When I tried to run the site I got the following error regarding MS_attributerouteWebApi

I went to the documentation and under the configuration section for the content delivery api documentation (link) I found my answer. By installing both the CMS and the Search package I’m calling (HttpConfiguration)config.MapHttpAttributeRoutes() two times. In order to fix this error, I followed the instructions in the documentation and disabled settings from ContentDeliveryApiSearch by adding the following to my <appSettings>

<add key="episerver:contentdeliverysearch:maphttpattributeroutes" value="false" />

Note: You may be needed to disable settings for the cms package as well if you're already running the ServiceAPI (its explained in the link above).

With the change the site ran smoothly, and I could make sure that the contentapiread user had the proper access and start querying in the browser (e.g. http://localhost:61704/api/episerver/v2.0/site/)


Although when moving over to Postman I only got back a response in HTML which included the log-in screen. I realized it had something to do with authorization. Since I just wanted to get started quickly I looked at our music festival demo site (link) where they set the default minimum role to Empty in order to bypass the step of authorization. This suits me quite well when exploring the API in localhost so I created an Initialization module that sets the default minimum role to Empty.

    public class ContentDeliveryApiInitialization : IConfigurableModule
        public void Initialize(InitializationEngine context)
            //Add initialization logic, this method is called once after CMS has been initialized

        public void Uninitialize(InitializationEngine context)
            //Add uninitialization logic

        public void ConfigureContainer(ServiceConfigurationContext context)
            // set minimumRoles to empty to allow anonymous calls (for visitors to view site in view mode)
            context.Services.Configure<ContentApiConfiguration>(config =>

 After a rebuild everything was set up and the querying from Postman worked as well.


Hopefully this helps you to get the API up and running and start exploring its capabilities.

Nov 21, 2018


valdis Nov 23, 2018 06:53 AM

I would recommend to rethink whole attribute based mapping initialization routine and "promote" call to some generic module. meaning that there might be multiple packages installed that require attribute based routing, those register some hooks that episerver initialization engine can callback and initialize every single package. that would avoid cases like these. very similar as IConfigurableModule and friends are working - somebody (frameowrk) is calling me. hollywood effect.

Please login to comment.
Latest blogs
ExtendedCms.TinyMceEnhancements – serwer side webp support

Today I will introduce another small feature of TinyMceEnhancements plugin. The functionality is used to automatically detect whether a browser...

Grzegorz Wiecheć | May 22, 2024 | Syndicated blog

Azure AI Language– Detect Healthcare Content in Optimizely CMS

In this blog post, I showcase how the Azure AI Language service's Text Analytics for health feature can be used to detect healthcare content within...

Anil Patel | May 22, 2024 | Syndicated blog

Stott Security Version 2 So Far

In December 2023, I unveiled the initial version of Stott Security version 2. Although I typically announce each version I release on LinkedIn and...

Mark Stott | May 22, 2024

Optimizely Data Platform (ODP) Page Scroll Tracking

As with my last post, this isn’t a “getting started with ODP” — to get started with ODP, check out the developer docs,   “Implement the ODP...

Daniel Isaacs | May 22, 2024