简体   繁体   中英

FOSRestBundle No route found

I'm having difficulty getting a call to an API working using FOSRestBundle.

users:
    type:     rest
    resource: GU\GreetupBundle\Controller\UsersController

.

class UsersController extends FOSRestController implements ClassResourceInterface
{

    public function postUserLocationAction($id, Request $request)
    {

        var_dump($request->attributes); die();
    }
}

According to the documentation this should work:

curl {{url}}/users/:id/location

but I get the following No route found for "POST /users/1/location"

Using bin/console debug:router should help you.

It returns all the routes registered and you will be able to find the one corresponding to your controller (for debugging).

Once it's done, don't hesitate to add more informations to be helped further ;)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM