Drupal JSON:API authorization – Drupal Answers

I’m at the early stages of trying to figure out the Drupal JSON API and can’t figure out what’s causing Some resources have been omitted because of insufficient authorization and The current user is not allowed to GET the selected resource in the response.

Is there a header I should be using? It’s all local so there’s no basic auth to get past.

My code:

  fetch('http://localhost/domain-6/jsonapi/group_content/microsite-group_menu-main', {
    method: 'GET',
    mode: 'no-cors',
    headers: {
      'Accept': 'application/vnd.api+json',
      'Content-Type': 'application/vnd.api+json'
  .then(response => response.json())
  .then(data => {
  .catch((error) => {
    console.error('Error: ', error);

The response was flagged as spam so I can’t post it here but it’s at https://pastebin.com/9M4kYyR6

How google offers questions and answers in search for specific sites

How does google offers questions and answers for specific sites like this?

enter image description here

Redirection 301 – Drupal Answers

I used the redirect module to do a 301 redirection. Everything works fine for the first few hours. Then, afterwards when I enter the old link, the redirection doesn’t work anymore. If I go and clear caches and try again , the redirection works again. Then If I wait again, the redirection stops to work.. so each time I have to clear cache and that’s annoying ! Why is that happening?

8 – prepareDirectory – Drupal Answers

I am trying to make a file upload operation in a module (made by myself) in Drupal 9.

The files are coming from different users and I try to save them into user specific subdirectories of public://.

Here’s my code

use DrupalCoreControllerControllerBase;
use DrupalCoreFile;
use DrupalCoreFileFileSystemInterface;
use SymfonyComponentHttpFoundationJsonResponse;
public function content($id)
        prepareDirectory("public://$id", CREATE_DIRECTORY);
        foreach ($_FILES as $file) {
            $data = file_get_contents($file('tmp_name'));
            $name = $file('name');
            $size = $file('size');
            $url = "public://$id/$name";
            $result = file_save_data($data,$url, FileSystemInterface::EXISTS_REPLACE);
        return new JsonResponse(('data' => ("name" => $name, "url" => $url, "size" => $size,"result" => $result), 'method' => 'POST', 'status' => 200));


Everything works great if public://$id-directory exists (and I don’t have that prepareDirectory()-call). prepareDrectory() gives though an error Call to undefined function Drupalmy_moduleControllerprepareDirectory() which I cannot understand as file_save_data works just fine.

I prefer segregating the files for different users because there is quite a high probability of name clashes because the documents may have quite similar contents.



Targeted Traffic 21 High Quality Quora Answers With Your Keyword & URL for $10

Targeted Traffic 21 High Quality Quora Answers With Your Keyword & URL

Promote your website by creating 21 HQ Quora Answer for targeted traffic
Welcome to my Profile

Great offer!!! Great offer!!! Great offer!!!
I’m Here to served SEO related project. I work professionally on Seo (Search Engine Optimization). This service is a link-building related Service. If you don’t know how to promote your website with organic traffic. Quora is an authority website like Yahoo Answers. Now most of the visitors try to find their question answers in Quora. You can get a lot of authority traffic to your website from Quora. It helps you to create link building in Quora and make your website authority. Get a lot of traffic.

You Will Get:

  1. Guaranteed Traffic and Backlinks
  2. High Quality backlinks
  3. All Answer done by manually
  4. Answer any niche of website
  5. 100%Organic traffic
  6. 24/7 Hour help you if you face any problem with my work.
  7. On-time delivery and it’s my target.


Guaranteed Traffic by 30 High-Quality Quora Answers. for $15

Guaranteed Traffic by 30 High-Quality Quora Answers.

I will write for you 30 QUORA HQ answer relevant yournicheIs your website or store missing out on targeted traffic because you don’t

have the most effective Quora profile?

I’m very passionate about Quora marketing and management andhave worked for many successful projects for bloggers, small quora businesses

as a professional marketing and management manager for over the last 2 years. I

will write your question answer around 200-250 words with one image.

Benefits of my service

Guaranteed Traffic and Backlinks.

High-Quality backlinks

All Answer has done by manually

answer any niche of website

Answer will not keep Delete

full report in excel sheet.

100%Organic traffic

If you need more services on QUORA then knock me viamassage.

Thank you


theming – Override fieldset.html.twig – Drupal Answers

I am having some trouble understanding the concept of overriding twig templates. I have turned on debugging mode and most of the time I see overriding suggested file names like this:

   * form-element--webform-generate-system-number-form-1--form--department.html.twig
   * form-element--webform-generate-system-number-form-1--form.html.twig
   x form-element--webform-generate-system-number-form-1.html.twig
   * form-element--webform-select.html.twig
   * form-element.html.twig

however, there is one, fieldset.html.twig that does not have suggested file names.

<!-- THEME DEBUG -->
<!-- THEME HOOK: 'fieldset' -->
<!-- BEGIN OUTPUT from 'themes/custom/bootstrap/templates/form/fieldset.html.twig' -->

now I know I can write a hook for fieldset and create a hook_suggestion, but is there an easier approach to this, such as a pattern?

fieldset--webform-generate-system-number-form-1.html.twig does not seem to work.

probability – How to generate wrong answers for multiple choice quiz?

Imagine I make a multiple choice quiz that contains the question:

How many Star Wars collectibles do I have at home?

Now, the correct answer is 324. So I come up with two false answers that seem convincing to me and write them down as alternatives:

A] 258, B] 324, C] 400

My clever friend has no idea whatsoever, but deduces that since I just made these numbers up on the spot, I probably picked one lower and one higher than the real number and correctly answers B. Oh no! How could I have generated false answers so they could not have been used to deduce the correct answer?

Calling Taxonomy in Webform – Drupal Answers

How I can call the Taxonomy field In the “SEND TO” option of general settings in Email/handlers settings.
To brief the request.
I have a Taxonomy term “xxx” which has a list of location terms added to it. I have a Webform, post filling that I want to send a notification mail to be sent to the Emil IDs added in one of the fields of the Taxonomy Term.
Please help me on how I can achieve this.

Provide 20 HQ Quora Answers With Clickable Link for your website for $10

My Service type:*Clients satisfaction.*100% safe & firstdelivery.*100% Complete yourorder.*I will post allanswers manually.*Response in yourorder time.

by: sinthia2002
Created: —
Category: Question/Answer
Viewed: 291