- π³π±Netherlands vinlaurens Utrecht, The Netherlands
Having the same issue on my end. Any known solution to this?
I followed this tutorial -> https://www.drupal.org/docs/8/api/restful-web-services-api/custom-rest-r... β to set up a customer REST endpoint.
Here is my module
<?php
namespace Drupal\demo_rest_api\Plugin\rest\resource;
use Drupal\rest\Plugin\ResourceBase;
use Drupal\rest\ResourceResponse;
/**
* Provides a Demo Resource
*
* @RestResource(
* id = "demo_resource",
* label = @Translation("Demo Resource"),
* uri_paths = {
* "canonical" = "/demo_rest_api/demo_resource"
* }
* )
*/
class DemoResource extends ResourceBase {
/**
* Responds to entity GET requests.
* @return \Drupal\rest\ResourceResponse
*/
public function get() {
$response = ['message' => 'Hello, this is a rest service'];
return new ResourceResponse($response);
}
}
Here is my rest config:
langcode: en
status: true
dependencies:
module:
- basic_auth
- node
id: demo_resource
plugin_id: demo_resource
granularity: resource
configuration:
methods:
- GET
formats:
- json
authentication:
- basic_auth
My module is installed and its rest config was loaded into the database.
On the native Permissions screen, a new permission called "Access GET on Demo Resource resource" appeared in the "RESTful Web Services" section.
That permission is now enabled for authenticated users.
Nevertheless, making a GET request to the defined endpoint results in 403 Forbidden
response status and the following response body:
{
"message": "The 'restful get demo_resource' permission is required."
}
I am sending basic auth credentials and the CSRF token. FWIW, I have also enabled REST services for the built in Page entity, and requests I make to those endpoints, which use the same auth headers, are working.
Is there perhaps some other permission that needs to be flipped? I've been reading a few other bug reports and issue related to this, but no common theme or fix. I appreciate any help you can offer.
Fixed
10.1 β¨
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Having the same issue on my end. Any known solution to this?