Hi, I am trying to set up my own API endpoint by addon. I need to have a controller methods under some multi-word API path. My goal is to have endpoint like this:
http://localhost:8080/api/custom/collections/get?token=xxx
where ‘get’ will be one of actions from my addon controller.
So in my addon bootstrap.php I added:
if (COCKPIT_API_REQUEST) {
$this->on('cockpit.rest.init', function ($routes) {
$routes['custom/collections'] = 'CustomAddon\\Modules\Collections\\Controller\\RestApi';
});
}
It not works. I have also tested with dot, full api path etc. And I also couldn’t find information about how I can do this. Maybe some of us know how can I hook full conroller methods under complex API path from addons or mabe from other way?