Cakephp trigger bad route


I have a problem with the routing. I have an API coded with Cakephp 3.9 and when I call it it calls me another route.

I want to call the route /api/order/customer-quotation by POST, but the /api/order/:id by GET route is called…

Here is a capture of my code:

Router::plugin('Api', ['path' => '/api'], function ($routes) {

    $routes->registerMiddleware('api-firewall', new \Api\Middleware\ApiFirewallMiddleware());

    $routes->scope('/order', ['controller' => 'Order'], function($routes) {
        $routes->connect('/customer-quotation', ['action' => 'createOrder'], ['_name' => 'create_order'])->setMethods(['POST']);
        $routes->connect('/:id', ['action' => 'getOrderDetails'], ['_name' => 'order_details'])->setMethods(['GET']);

I can not understand

Thank you

1 Like