Filipe Batista
Filipe Batista

Reputation: 1854

Restler mapping protected methods

I am using Restler 2.1.5 and i have a class with the index method protected.

protected function index($id){
//do something
}

I added new protected method but not able to call that method.

protected function method(){
//do stuff
}

When i call http://localhost/api/index.php/class?key=foo it runs all OK

But when i call http://localhost/api/index.php/method?key=foo it gives me not found

What can be causing this?

Upvotes: 0

Views: 359

Answers (1)

Arul Kumaran
Arul Kumaran

Reputation: 993

It is because you are looking at the wrong place!

try the following url instead

http://localhost/api/index.php/class/method?key=foo

If you do not pass '' (blank String) as the second parameter to $r->addAPIClass() name of the class will be included in the route and thus you need to include it in your url too

You should also understand the ambiguity and order of priority, reading this thread will help you

Upvotes: 1

Related Questions