I installed the Element API plugin and the elementapi.php file within the craft/config/ folder is set up just like the example on Github. I'm also trying to use this with a section called "news" like the example. However, when I try to access news.json I get a 404. Am I missing something? Do I need to call something in my templates to make that feed available?

2 Answers 2


That plugin doesnt append any file extensions to the routes. Try either changing the route in elementapi.php to news.json or try to visit http://yoursite.dev/news

  • So are you saying that if I visit mysite.dev/news I should see the JSON coming through the network if I inspect the page? I have news.json as the endpoint in the elementapi.php
    – Keith
    Feb 17, 2016 at 19:36
  • Hmm that should work... is there anything showing up? Do you get a 404 or just a white page? Could you post what you have in elementapi.php into your original question Feb 17, 2016 at 19:42
  • Also worth checking the logs to see if anything is being logged when you hit that route. Feb 17, 2016 at 19:42

I know this is a very old thread, but I stumbled onto it today because I was having a similar problem. I found that the source of my particular problem was due to the fact that I was also using Redirect plugin for Craft 3 on the site. The Redirect plugin appends a route to redirect everything to the 404 handler. I assume it was meant to be the last appended rule and to act as a default handler in the event no other route is matched. Unfortunately the element-api route got appended to the route rules array after that Redirect plugin default route, so the Craft routing never read the element-api route.

I deactivated the Redirect plugin and the element-api routing works now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.