<p>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. </p>

<p>I deactivated the Redirect plugin and the element-api routing works now.</p>

CC BY-SA 4.0
2019-03-01T16:25:11.303Z
2019-03-01T16:25:11.303Z
Bill Bushee
<p>That plugin doesnt append any file extensions to the routes. Try either changing the route in <code>elementapi.php</code> to <code>news.json</code> or try to visit <a href="http://yoursite.dev/news" rel="nofollow">http://yoursite.dev/news</a></p>

CC BY-SA 3.0
2016-02-17T19:36:39.157Z
So are you saying that if I visit http://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
CC BY-SA 3.0
2016-02-17T19:42:24.670Z
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
Seán O'Grady
CC BY-SA 3.0
2016-02-17T19:42:51.773Z
Also worth checking the logs to see if anything is being logged when you hit that route.
Seán O'Grady
CC BY-SA 3.0
2016-02-17T19:32:46.863Z
2016-02-17T19:32:46.863Z
Seán O'Grady
<p>I installed the Element API plugin and the <code>elementapi.php</code> 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 <code>news.json</code> I get a 404. Am I missing something? Do I need to call something in my templates to make that feed available?</p>

<plugin-elementapi>
Accessing the Element API JSON
# Accessing the Element API JSON

(Asked by: username_0 on 2016-02-17)

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?

**Tags:** plugin-elementapi

---

## 2 answers

### Answer by username_1 on 2019-03-01. Score: 1

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.


---

### Answer by username_2 on 2016-02-17. Score: 1

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>

> **Comments:**
> **username_0**: So are you saying that if I visit http://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`  
> **username_2**: 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  
> **username_2**: Also worth checking the logs to see if anything is being logged when you hit that route.  

---

