Working Example On Yii2 Restful Web Service

Anyone has working example on implementing RESTful Web Service APIs? I tried to follow the doc, but not able to get it to work.

Yes,

see this

http://www.yiiframework.com/forum/index.php/topic/53568-implementing-restful-web-service-apis/page__view__findpost__p__246601

Thank! That works. But how to modify the urlManager’s rules such that it will not block other http request?

For example, with following urlManager setting, gii is not working. I have to comment it off before using gii.




        'urlManager' => [

            'enablePrettyUrl' => true,

            'enableStrictParsing' => true,

            'showScriptName' => false,

            'rules' => [

                ['class' => 'yii\rest\UrlRule', 'controller' => 'user'],

            ],

        ],



Another question: When the model is of multiple words, e.g. DummyWorker, with controller DummyWorkerController, it does not work.

I have tried with following URLs. But none of them can work.

http://localhost/yii2_basic/web/index.php/DummyWorks

http://localhost/yii2_basic/web/index.php/dummyWorks

http://localhost/yii2_basic/web/index.php/dummyworks

Anyone encounter same problem?

you must use dash, like this: dummy-works

(in case of DummyWorkerController - dummy-worker)