Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Content Delivery Api - APIs return 404 in browser, but works in Postman

Vote:
 

Hello,

I'm testing out Content Delivery API by running it locally on my machine. In order to acess the endpoints I've set up, I use http://localhost:port/api/episerver/v2.0/content{contentId}.

When I issue get requests on this endpoint through Postman, I'm sucessfully retrieve the data I'm expecting. 

However, when I use the browser, either through a front-end application or directly go to the endpoint url in the browser, I recieve this response: {"error":{"code":"NotFound","message":"Content was not found"}}

I have given read access to all the content in EPiServer Admin Portal to the contentapiread user. 

Below is the output code for the working Postman request.

GET /api/episerver/v2.0/content/1 HTTP/1.1
Host: localhost:62478
User-Agent: PostmanRuntime/7.13.0
Accept: */*
Cache-Control: no-cache
Postman-Token: e6e8d194-ae40-4114-948a-589d69d2e45a,d8f777b8-29f9-4eba-abbb-97c849bd2059
Host: localhost:62478
accept-encoding: gzip, deflate
Connection: keep-alive
cache-control: no-cache

If you need further information, please ask and I will provide.

Has anyone experienced this before?

#204538
Jun 05, 2019 15:52
Vote:
 

Hi Martin

It can have multiple causes.

  1. Is langauge correctly given? If you try to request a page in another language then is present you also recieve a 404. In my case I needed to specifify 'en' in the request to make it work
    Accept-Language: en
    accept: application/json

2. If the friendly url is not working but the API url is try this

https://world.episerver.com/forum/developer-forum/Addons/Thread-Container/2019/5/headless-api---404-not-found/

It is important to have to correct handlers in the web.config otherwise the routing does not work.

#204549
Jun 06, 2019 11:47
MartinNenseth - Jun 06, 2019 12:23
Thank you so much!
Passing the language in the header worked. :)
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.