I followed the following page and installed the Episerver.ContentDeliveryApi package 2.11 on Episerver cms 11.15.0. I am getting 404 when I try to access sitedefinition url or any other API content url. Here is what I did so far. I followed the instructions on this page https://world.episerver.com/documentation/developer-guides/content-delivery-api/getting-started/
1) I installed the following packages when installing EpiServer.ContentDeliveryApi package. I installed version 2.11 as that is version compatible with the Episerver cms version 11.15 that we have.
<package id="EPiServer.ContentDeliveryApi" version="2.11.0" targetFramework="net471" /> <package id="EPiServer.ContentDeliveryApi.Cms" version="2.11.0" targetFramework="net471" /> <package id="EPiServer.ContentDeliveryApi.Core" version="2.11.0" targetFramework="net471" /> <package id="EPiServer.ContentDeliveryApi.OAuth" version="2.6.0" targetFramework="net471" />
2) Set Access rights for the contentapiread Read access for root item and its descendants.
3) Created the following initialization class as shown
public class ContentApiInitialization : IConfigurableModule
public void ConfigureContainer(ServiceConfigurationContext context)
// set minimumRoles to empty to allow anonymous calls (for visitors to view site in view mode)
public void Initialize(InitializationEngine context)
public void Uninitialize(InitializationEngine context)
4) It showed CustomContentApiRoutingEventHandler is not found in the project. Hence searched and found this article and used this as the class as shown below:
public class CustomContentApiRoutingEventHandler : RoutingEventHandler
: base(routeEvents, httpContextAccessor, contentApiRouteService)
// If language does not exists in the routing context, we return ContentLanguage.PreferredCulture as default language
protected override string GetLanguage(SegmentContext routingContext, HttpRequestBase request)
var language = routingContext.Language ?? routingContext.ContentLanguage ?? ContentLanguage.PreferredCulture.Name;
5) Then after compilation, tried to access the following urls
But both of these returned 404. Am I missing something or made any mistake in trying to get the ContentDeliveryAPI? Could someone let me know How I can debug and see whats happening and how I can correct this issue with the ContentDeliveryApi.
Thanks in advance
The accept-language is the primary way of setting the language you want else you'll get a 404. Can you try setting this header value to the language of the content you want when calling http://www.mywebsite.com/api/episerver/v2.0/content/5/
I tried using postman to send the Accept-Language header, but it gave me 404 still when calling http://wwwmywebsite.com/api/episerver/v2.0/content/5/
It may come from this setting in web.config: episerver:contentdelivery:maphttpattributeroutes. If you don't install other apis, then, no need for this configuration (or its value should be true). This setting will decide whether .net engine should scan controllers and do routing or not.
Content suppliers, such as media businesses and e-commerce enterprises, pay CDN operators to transport their content to end-users. CDNs pay ISPs, carriers, and network operators to host servers in their data centers. The following are the two main mechanisms that explain how CDN works:
Apart from improved performance, CDNs unload traffic provided straight from the content provider's origin infrastructure, potentially saving the content provider money. They're also good against DDoS attacks because they have their own network.