Answers.Body: <p>If you're hitting <code>/api/news.json</code> in the browser, you'd want to define the endpoint as <code>'api/news.json'</code> as well.  i.e.</p>
  
  <pre><code>&lt;?php
  namespace Craft;
  
  return [
      'endpoints' =&gt; [
          'api/news.json' =&gt; [
              'elementType' =&gt; 'Entry',
              'criteria' =&gt; ['section' =&gt; 'news'],
          ]
      ]
  ];
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-15T20:06:46.107Z
Answers.LastActivityDate: 2017-05-15T20:06:46.107Z
Answers.UserDisplayName: Brad Bell
Body: <p>I'm running Craft CMS 2.6.2972 so I had to use <a href="https://github.com/craftcms/element-api/tree/1.2.1" rel="nofollow noreferrer">the older Element API plugin</a>.</p>
  
  <p>I have downloaded the zip and then copied just the "elementapi" file in the zip to the plugin's folder.</p>
  
  <p>Then I installed the plugin in the admin panel.</p>
  
  <p>Then I made a file craft/config/elementapi.php with the contents</p>
  
  <pre><code>&lt;?php
  namespace Craft;
  
  return [
      'endpoints' =&gt; [
          'news.json' =&gt; [
              'elementType' =&gt; 'Entry',
              'criteria' =&gt; ['section' =&gt; 'news'],
          ]
      ]
  ];
  </code></pre>
  
  <p>But if I hit the URL <code>&lt;myserver&gt;/api/news.json</code> then I get the following error:</p>
  
  <pre><code>2017/05/12 17:31:47 [error] [exception.Craft\HttpException.404] exception 'Craft\HttpException' in C:\inetpub\wwwroot\craft\app\controllers\TemplatesController.php:59 Stack trace:
  #0 [internal function]: Craft\TemplatesController-&gt;actionRender('api/news.json', Array)
  #1 C:\inetpub\wwwroot\craft\app\framework\web\actions\CAction.php(109): ReflectionMethod-&gt;invokeArgs(Object(Craft\TemplatesController), Array)
  #2 C:\inetpub\wwwroot\craft\app\framework\web\actions\CInlineAction.php(47): CAction-&gt;runWithParamsInternal(Object(Craft\TemplatesController), Object(ReflectionMethod), Array)
  #3 C:\inetpub\wwwroot\craft\app\framework\web\CController.php(308): CInlineAction-&gt;runWithParams(Array)
  #4 C:\inetpub\wwwroot\craft\app\framework\web\CController.php(286): CController-&gt;runAction(Object(CInlineAction))
  #5 C:\inetpub\wwwroot\craft\app\framework\web\CController.php(265): CController-&gt;runActionWithFilters(Object(CInlineAction), Array)
  #6 C:\inetpub\wwwroot\craft\app\framework\web\CWebApplication.php(282): CController-&gt;run('render')
  #7 C:\inetpub\wwwroot\craft\app\framework\web\CWebApplication.php(141): CWebApplication-&gt;runController('templates/rende...')
  #8 C:\inetpub\wwwroot\craft\app\etc\web\WebApp.php(290): CWebApplication-&gt;processRequest()
  #9 C:\inetpub\wwwroot\craft\app\framework\base\CApplication.php(185): Craft\WebApp-&gt;processRequest()
  #10 C:\inetpub\wwwroot\craft\app\index.php(62): CApplication-&gt;run()
  #11 C:\inetpub\wwwroot\public\index.php(14): require_once('C:\\inetpub\\wwwr...')
  #12 {main} REQUEST_URI=/api/news.json
  ---
  </code></pre>
  
  <p>What might be wrong?</p>
  
  <p>This is running on IIS and I've added .json to the mime types for the site.</p>
  
  <p>This error is the same error as an unhandled link/route. So seems like it's not picking up the config or I have the wrong URL. The plugin did install ok.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-12T23:14:39.837Z
Comments.Text: If you're hitting `/api/news.json` in the browser, pretty sure the endpoint should be defined as `'api/news.json' => [`.
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-15T19:04:02.880Z
Comments.Text: Thanks That was it althought the example doesnt show it like that. If you want to make this an answer can give you credit.
Comments.UserDisplayName: Tim
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-15T20:07:19.247Z
Comments.Text: Fair enough... done!
Comments.UserDisplayName: Brad Bell
Tags: <plugins><plugin-elementapi>
Title: Configuring Element API 1.2.1 Plugin
ThreadText: # Configuring Element API 1.2.1 Plugin
  
  (Asked by: username_0 on 2017-05-12)
  
  I'm running Craft CMS 2.6.2972 so I had to use [the older Element API plugin](https://github.com/craftcms/element-api/tree/1.2.1).
  
  I have downloaded the zip and then copied just the "elementapi" file in the zip to the plugin's folder.
  
  Then I installed the plugin in the admin panel.
  
  Then I made a file craft/config/elementapi.php with the contents
  
  ```
  <?php
  namespace Craft;
  
  return [
      'endpoints' => [
          'news.json' => [
              'elementType' => 'Entry',
              'criteria' => ['section' => 'news'],
          ]
      ]
  ];
  
  ```
  
  But if I hit the URL `<myserver>/api/news.json` then I get the following error:
  
  ```
  2017/05/12 17:31:47 [error] [exception.Craft\HttpException.404] exception 'Craft\HttpException' in C:\inetpub\wwwroot\craft\app\controllers\TemplatesController.php:59 Stack trace:
  #0 [internal function]: Craft\TemplatesController->actionRender('api/news.json', Array)
  #1 C:\inetpub\wwwroot\craft\app\framework\web\actions\CAction.php(109): ReflectionMethod->invokeArgs(Object(Craft\TemplatesController), Array)
  #2 C:\inetpub\wwwroot\craft\app\framework\web\actions\CInlineAction.php(47): CAction->runWithParamsInternal(Object(Craft\TemplatesController), Object(ReflectionMethod), Array)
  #3 C:\inetpub\wwwroot\craft\app\framework\web\CController.php(308): CInlineAction->runWithParams(Array)
  #4 C:\inetpub\wwwroot\craft\app\framework\web\CController.php(286): CController->runAction(Object(CInlineAction))
  #5 C:\inetpub\wwwroot\craft\app\framework\web\CController.php(265): CController->runActionWithFilters(Object(CInlineAction), Array)
  #6 C:\inetpub\wwwroot\craft\app\framework\web\CWebApplication.php(282): CController->run('render')
  #7 C:\inetpub\wwwroot\craft\app\framework\web\CWebApplication.php(141): CWebApplication->runController('templates/rende...')
  #8 C:\inetpub\wwwroot\craft\app\etc\web\WebApp.php(290): CWebApplication->processRequest()
  #9 C:\inetpub\wwwroot\craft\app\framework\base\CApplication.php(185): Craft\WebApp->processRequest()
  #10 C:\inetpub\wwwroot\craft\app\index.php(62): CApplication->run()
  #11 C:\inetpub\wwwroot\public\index.php(14): require_once('C:\\inetpub\\wwwr...')
  #12 {main} REQUEST_URI=/api/news.json
  ---
  
  ```
  
  What might be wrong?
  
  This is running on IIS and I've added .json to the mime types for the site.
  
  This error is the same error as an unhandled link/route. So seems like it's not picking up the config or I have the wrong URL. The plugin did install ok.
  
  **Tags:** plugins, plugin-elementapi
  
  > **Comments:**
  > **username_1**: If you're hitting `/api/news.json` in the browser, pretty sure the endpoint should be defined as `'api/news.json' => [`.  
  > **username_0**: Thanks That was it althought the example doesnt show it like that. If you want to make this an answer can give you credit.  
  > **username_1**: Fair enough... done!  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-05-15. Score: 1 | Accepted answer
  
  If you're hitting `/api/news.json` in the browser, you'd want to define the endpoint as `'api/news.json'` as well. i.e.
  
  ```
  <?php
  namespace Craft;
  
  return [
      'endpoints' => [
          'api/news.json' => [
              'elementType' => 'Entry',
              'criteria' => ['section' => 'news'],
          ]
      ]
  ];
  
  ```
  
  
  ---
  
  