Sorry,
I'm stuggling to get a custom API endpoint to work. I was wondering if anyone could advise where I'm going wrong?
I have the following at:
custom/Espo/Modules/VenueFundraisers/Resources/routes.json
I've created a controller at:
custom/Espo/Modules/VenueFundraisers/Controllers/VenueFundraisers.php
(also tried having controller at: custom/Espo/Custom/Controllers/VenueFundraisers.php)
Trying to hit endpoint at:
I get 404.
Any help would be much appreciated.
I'm stuggling to get a custom API endpoint to work. I was wondering if anyone could advise where I'm going wrong?
I have the following at:
custom/Espo/Modules/VenueFundraisers/Resources/routes.json
PHP Code:
[
{
"route": "VenueFundraisers/:venueId",
"method": "get",
"params": {
"controller": "VenueFundraisers",
"action": "getFundraisersForVenue",
"venueId": ":venueId"
}
}
]
custom/Espo/Modules/VenueFundraisers/Controllers/VenueFundraisers.php
(also tried having controller at: custom/Espo/Custom/Controllers/VenueFundraisers.php)
PHP Code:
<?php
namespace Espo\Modules\VenueFundraisers\Controllers;
use Espo\Core\Exceptions\NotFoundHttpException;
use Espo\Core\Exceptions\BadRequestException;
use Espo\Core\Api\Request;
use Espo\Core\Api\Response;
use Espo\Core\Api\ResponseComposer;
class VenueFundraisers
{
public function getFundraisersForVenue(Request $request, Response $response): void
{
$venueId = $request->getRouteParam('venueId');
$response->setBody(ResponseComposer::json($venueId));
}
}
https://espocrm-domain.uk/api/v1/VenueFundraisers/65c39997dad3a58a1
I get 404.
Any help would be much appreciated.
Comment