Phil Sturgeon’s REST API always returning: status:0, error:Unknown method Phil Sturgeon’s REST API always returning: status:0, error:Unknown method codeigniter codeigniter

Phil Sturgeon’s REST API always returning: status:0, error:Unknown method


I think your problem is the name of controller is the same with the name of method try to make a test:

if the name of your controller is:

class Test extends REST_Controller{    //your method name is different from the name of controller class    public function testget_get(){         echo $this->response(array('test'=> 'test'), 200);    }}

I have experienced this problem on hmvc structure.


You also need to check that from device which method your are getting means they are sending 'POST' or 'GET' so you can update your function name accordingly.

In my case I have done the function name as _get to the methods but from device methods of sending parameter is 'POST' which I am trying to access as 'GET'.

So please cross check this once.


When you create a method with the library, you need to append the type of request you are going to make to it.

So, if your method is test, and you are making a GET request to it, it needs to look like this:

function test_get(){    ...}

Same with POST requests

function test_post(){    ...}

Same with PUT, and DELETE as well.

NB This is only a guess since you didn't include any of your code for some reason.