How To Apply Restfull Service To Controllers Inside Modules.

I have a controller named Notes in modules admin.

i.e, The path is app/protected/modules/admin/controllers/NotesController

I want to apply restfull service to this controller.

I had installed the extensions named RESTFullYii ,

the link is , and i had followed the instructions to install this extensions,

I had create a sample test controller in protected/controller folder ,and when i tried it with below functions inside controller,

  public function restEvents() {

         $this->onRest('model.instance', function() {

             return new ProfileNotes();



it throws output as {"success":false,"message":"Unauthorized","data":{"errorCode":401,"message":"Unauthorized"}}

if i tried it with

 public function restEvents() {

          $this->onRest('req.auth.ajax.user', function() {

                    return true;



it’s working and outputs the json data.

the url for that is localhost/example/api/Sample

But the problem is when i tried to apply the same feature to controllers inside module

it throwing the error,


The system is unable to find the requested action "error"

the url is localhost/example/admin/api/Notes

iam doing anything wrong ,

Anyone had successfully implemented the restfull service inside modules.


I also experienced this error when using RestfullYii, but in my case, it had to do with another extension yii-user.

It seamed that Yii-user had a few incompatible functions I guess that webUser didnt like.

I managed to edit ProfileFieldController.php

and modified line 493 public function loadModel() to

public function loadModel($id = NULL, $model = false)

and line 549 protected function performAjaxValidation($model)

to: protected function performAjaxValidation($model, $form)

and this seamed to fix the problem.

I hope this helps