I have been searching for an example of creating manual/custom routes in Restler 3 to achieve a URL like this.
http://domain.com/api/v1/solution/categories/{category-id}/folders/{folder-id}/articles/{article-id}.json
I would like everything handled by the Solution class. I would like a seperate method for each get(). Is this possible?
Defaults::$useUrlBasedVersioning = true;
$r = new Restler();
$r->setSupportedFormats('JsonFormat', 'XmlFormat');
$r->setAPIVersion(1);
$r->addAPIClass('Luracast\\Restler\\Resources');
$r->addAPIClass('Solution');
$r->addAuthenticationClass('AccessControl');
$r->handle();
I have experimented with the Routing examples with no luck thus far.
http://restler3.luracast.com/examples/_006_routing/readme.html
Here is a working example
<?php
class Solution
{
/**
* @url GET categories/{category_id}/folders/{folder_id}/articles/{article_id}
*/
public function categories($category_id, $folder_id, $article_id)
{
return func_get_args();
}
}