Extrapatterns Rules For Rest Api

Which is the best way to create customize actions using restful api?

I’ve followed the docs example to implement a search action in a yii\rest\Controller .

public function actionSearch($keyword) {

        return 123;


and in main I am using this configuration for urlManager

 'urlManager' => [

            'enablePrettyUrl' => true,

            'enableStrictParsing' => true,

            'showScriptName' => false,

            'rules' => [

                ['class' => 'yii\rest\UrlRule', 'controller' => 'v1/api', 'extraPatterns' => [

                        'GET {keyword}' => 'search',


                    'tokens'=>['{keyword}' => '<keyword:\\d[\\d,]*>',],




This example works fine when I am calling this url


, it goes to the search action.

But now the problem is that I can’t get to my view action .

I want to make search to accept more parameters something like


but still to keep my view action .

I am pretty sure the problem is with my tokens configuration .

Thanks a lot !