I am working with yii2 , and I want to create rest api. I read yii2 rest api quick start documentation, but in there you can use only default actions(index/view/create/delete/list...). It is working fine
But I want to create another action for example
public function actionPurchasedcard(){
//some code
}
But I couldn't it. Help me please, how to create custome action in yii2 Rest api.
config.php
'urlManager' => [
'enablePrettyUrl' => true,
'enableStrictParsing' => true,
'showScriptName' => false,
'rules' => [
[
'class'=>'yii\rest\UrlRule',
'controller'=>[
'v1/resource',
]
],
]
]
document root:
htdocs/myapi/api/web/
I am calling like this : http://myapi/v1/resource/purchasedcard
Thanks.(sorry my english not good)