Welcome Guest, Not a member yet? Register   Sign In
Routing and REST server
#1

[eluser]Unknown[/eluser]
I'm trying to achieve the following URLs for my API (I'm using Codeigniter and Phil Sturgeon's REST server library):

Code:
/players            -> refers to index method in the players controller
/players/rookies    -> refers to rookies method in the players controller

I don't want the URL to have a trailing "index"

Code:
/players/index

This is no problem at all when I define the routes like so:

Code:
$route['players'] = 'players/index';

Everything works as expected.

My problem is that I need additional URL segments like so:

Code:
/players/rookies/limit/10/offset/5/key/abcdef

The above example works, but the following does not:

Code:
/players/limit/10/offset/5/key/abcdef

I'm getting the following error: {"status":false,"error":"Unknown method."} Obviously there is no limit method in my controller.

How do I have to setup my routes.php config file to get these URLs to work properly?

Any help is much appreciated!




Theme © iAndrew 2016 - Forum software by © MyBB