How do I get started with Element API plugin? I'd like to use the Element API plugin.
I've follow the instructions mentioned here: ElementAPI - Can I use javascript/ajax to load json

Here is my config/elementapi.php file :

&lt;?php
namespace Craft;

return [
    'endpoints' =&gt; [
        'news.json' =&gt; [
            'elementType' =&gt; 'Entry',
            'criteria' =&gt; ['section' =&gt; 'news'],
            'transformer' =&gt; function (EntryModel $entry) {
                return [
                    'title' =&gt; $entry-&gt;title,
                    'url' =&gt; $entry-&gt;url,
                    'jsonUrl' =&gt; UrlHelper::getUrl("news/{$entry-&gt;id}.json"),
                ];
            },
        ]
    ]
];


and here my ajax request:

    $(function () {
        var data = {
            'CSRF': $('input[name="CRAFT_CSRF_TOKEN"]').val(),
        };

        $.ajax({
            'type': 'post',
            'contentType': 'application/x-www-form-urlencoded; charset=UTF-8',
            'cache': false,
            'data': data,
            'url': 'news.json',
            'dataType': 'json',
            'timeout': 50000
        }).done(function (response) {
           console.log(response);
        }).fail(function (error) {
                console.log('totalfail')
            });
        });


But it always returns a 400 error (as the JSON file looks like it doesn't exist).

What have I missed? Could someone provide a working example?

Thanks!
There was a mistake in the ajax request. I was using POST instead of GET.

1) After installing the plugin :

Add elementapi.php to your /craft/config/ directory

&lt;?php
namespace Craft;

return [
    'endpoints' =&gt; [
        'news.json' =&gt; [
            'elementType' =&gt; 'Entry',
            'criteria' =&gt; ['section' =&gt; 'news'],
            'transformer' =&gt; function (EntryModel $entry) {
                return [
                    'title' =&gt; $entry-&gt;title,
                    'url' =&gt; $entry-&gt;url,
                    'jsonUrl' =&gt; UrlHelper::getUrl("news/{$entry-&gt;id}.json")
                ];
            },
        ]
    ]
];


2) Enabling CSRF Protection
add 'enableCsrfProtection' =&gt; true to your /craft/config/general.php file.

3) getting entries with ajax :

_layout.html 

&lt;head&gt;
...
&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"&gt;  &lt;/script&gt;
&lt;script&gt;
    $(function () {
        var data = {
            'CSRF': $('input[name="CRAFT_CSRF_TOKEN"]').val(),
        };

        $.ajax({
            'type': 'get',
            'contentType': 'application/x-www-form-urlencoded; charset=UTF-8',
            'cache': false,
            'data': data,
            'url': 'news.json',
            'dataType': 'json',
            'timeout': 50000
        }).done(function (response) {
            console.log(response);
        }).fail(function (error) {
                // Total fail.
            });
        });
    &lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;div id="container"&gt;
    {{ getCsrfInput() }}
...