Kentico 13 Rest API return 404

Mahmood Ahmed asked on August 30, 2023 14:03

Hi, I've deployed the latest build on the server. When I hit /rest/cms.country locally, I'm receiving data. However, after deploying it on the server, when I try to hit www.domain.com/admin/rest/cms.country, I'm getting a 404 response. My admin base url is www.domain.com/admin. Does anyone have an idea about this?

Recent Answers


Brenden Kehren answered on August 30, 2023 16:14

If you're on version 13, you want to hit the domain your CMS is located at. The REST API lives with the CMS application and not your front facing MVC site. To find this address specifically, look in the Sites application in Kentico and use that URL to access the REST API.

2 votesVote for this answer Mark as a Correct answer

Mahmood Ahmed answered on September 1, 2023 12:12

Thank you very much, Brenden. The issue was with the IIS server, which I fixed and it is now working. However, I am encountering another issue: "from origin 'http://localhost' has been banned by CORS policy: Response to preflight request fails access control check: it lacks HTTP ok status." Do you have any ideas? At the moment, the server does not have an SSL certificate.

0 votesVote for this answer Mark as a Correct answer

Dmitry Bastron answered on September 1, 2023 18:03

Hi Mahmood,

What application are you using to call this API? Do you call it from JavaScript on another website page? Does it return you data if you use Postman to query your www.domain.com/admin/rest/cms.country endpoint?

0 votesVote for this answer Mark as a Correct answer

Mahmood Ahmed answered on September 4, 2023 09:21 (last edited on September 4, 2023 09:48)

Hi Dmitry, Yes, postman returns data when I hit www.domain.com/admin/rest/cms.country, but when I hit using ajax or Vue, it returns error "from origin 'http://localhost' has been banned by CORS policy: Response to preflight request fails access control check: it lacks HTTP ok status."

0 votesVote for this answer Mark as a Correct answer

Dmitry Bastron answered on September 5, 2023 17:56

Mahmood, in this case all you need to do is set up correct CORS headers for your CMS admin solution, to allow querying API from your other domains.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.