SaaS CMS has officially launched! Learn more now.

Struggling with the basics


Hi All,

Can anyone help me out here? Essentially I am getting a load of 404 errors and I don't understand why.

What I've done so far


<package id="EPiServer.ContentDeliveryApi.Cms" version="2.14.0" targetFramework="net472" />
<package id="EPiServer.ContentDeliveryApi.Core" version="2.14.0" targetFramework="net472" />

I've added a initialisation module and added:


I've launched the site locally and in the CMS configured the permissions for the ContentApiRead role to have Read access to my site's startpage and set all decendants to inherit those access rights.

What I am experiencing

navigate to /api/episerver/v2.0/site/ and I am returned my site definition JSON as expected.

from that returned data I can see my site and within 'contentRoots' > 'startPage' is can see the content reference id, lets say it' 49747. So my next api call would be for the content of that startpage. There is some data in properties of the startpage that I want to use.

navigate to /api/episerver/v2.0/content/49747/ and I get a 404. Odd. At some point I'll want to get all the pages that exist under the start page anyway, so lets carry on.

navigation to /api/episerver/v2.0/content/49747/children/ and I get a response of []. Even though there are child pages under the startpage.

Upon further digging:

when I navigate to /api/episerver/v2.0/content/ for different kinds of content, I get different results. for example:

for pages = 404
for blocks = 404
for folders = yes, proper JSON response
for files = yes, same for files

/api/episerver/v2.0/content/{page content ref}/children/ = []
/api/episerver/v2.0/content/{folder content ref}/children/ = yes

So am I just misunderstanding the API or have I forgotten to configure something? 

Really appreciate a steer on this!


Sep 08, 2020 14:21

I would recommend using a client like postman to test your calls. Also remember to set language when calling api. You do this with a Accept-Language header. Without it you will get a 404. 

Read more here

Edited, Sep 08, 2020 14:56

Hi Daniel,

knocked that outta the park, didn't you!?!

explicitly setting the language header did that trick. Postman was auto-generating some headers and I'd completely missed that. and the browser was adding the language header in as a default, but I guess that isn't enough.

thanks for bailing me out on this! greatly appreciated.


Sep 08, 2020 15:33

Been there, done that, cried and cursed a little :)

Happy coding!

Sep 08, 2020 16:44
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.