PHP no route found for POST with FOSRestBundle
<p>I am working on a project were i have to use javascript to detect screen resolution, viewport...</p>

<p>I am using Symfony 2.8, and i created a REST API for posting(client side with ajax) screen setings to the server side (and put it in a Doctrine entities).</p>

<p>I am testing the API with:</p>

<pre><code>curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"screen":[{"id": 1,"resolution": "1920x1080", "viewport": "60x60", "device_ar": "1.5", "px_ratio": "1.00", "zoom": "8%"}]}' myurl/api/screen
</code></pre>

<p>and i have a wonderfull No route found for POST.</p>

<p>Here is my routing.yml:</p>

<pre><code>screen:
type:   rest
prefix: /api
resource:   MyBrowserBundle\Controller\ScreenController
methods: [POST]
</code></pre>

<p>and my screen controller:</p>

<pre><code>class ScreenController extends FOSRestController
{

/**
*   @var $resolution, $viewport, $device_ar, $px_ratio, $zoom
*   @Post()
*/
public function postScreenAction($resolution, $viewport, $device_ar, $px_ratio, $zoom)
{

    $userpost_screen = new Screen();

    $userpost_screen-&gt;setResolution($resolution);
    $userpost_screen-&gt;setViewport($viewport);
    $userpost_screen-&gt;setDeviceAr($device_ar);
    $userpost_screen-&gt;setPxRatio($px_ratio);
    $userpost_screen-&gt;setZoom($zoom);

    $em = $this-&gt;getDoctrine-&gt;getManager();
    $em-&gt;persist($userpost_screen);
    $em-&gt;flush();
}

}
</code></pre>

<p>And my config for fosrestbundle:</p>

<pre><code>fos_rest:
param_fetcher_listener: true
body_listener: true
format_listener: true
view:
    view_response_listener: 'force'
    formats:
        xml: true
        json : true
    templating_formats:
        html: true
    force_redirects:
        html: true
    failed_validation: HTTP_BAD_REQUEST
    default_engine: twig
routing_loader:
    default_format: json
</code></pre>

<p>I'm working on this since this morning and i still can't find what happend, a little help can be usefull :)</p>

<p>thanks</p>