In my REST API I have Work associated with an Order, so using Restler (3.0.0-RC6) I created this method:
class Orders {
/**
* Get completed work for order
*
* @param int $id The SQL identifier of the order
*
* @return array {@type Work}
*
* @url GET orders/{id}/works
*/
function getCompletedWork($id) {
So now I go to my url and enter ..../index.php/orders/1/works
and I get back a 404 from Routes.php:436 at route stage
What am I doing wrong?
Custom routes are also mapped along with the name of the class unless we provide an empty string as the second parameter while adding the Api class
$r->addAPIClass('Orders','');
So your example above is actually mapped to orders/orders/{id}/works
. You can fix with
class Orders {
/**
* Get completed work for order
*
* @param int $id The SQL identifier of the order
*
* @return array {@type Work}
*
* @url GET {id}/works
*/
function getCompletedWork($id) {