I'm using Drupal 9.5 to build my api inside my custom module. When I test the API URL on the browser it show me a message
message: "No route found for "GET /api/v1/api_resource""
<?php
namespace Drupal\demo_api\Plugin\rest\resource;
use Drupal\rest\Plugin\ResourceBase;
use Drupal\rest\ResourceResponse;
/**
* Provides the API resource for the mobile App
*
* @RestResource(
* id = "demo_api_resource",
* label = @Translation("Demo API Resouce"),
* uri_paths = {
* "canonical" = "/api/v1/api_resource/"
* }
* )
*/
class ApiResource extends ResourceBase {
public function get() {
$response = ['message' => 'Hello, this is a rest service'];
return new ResourceResponse($response);
}
I did configure in REST UI to accept the GET request with cookie authentication.
What could be the issue here?