RESTful API support

Fixes https://github.com/yiisoft/yii2/issues/303