Create a get all data REST resource

gabrieldev's picture

Hey guys! I have a problem. I want to create a get all data REST resource in Drupal 8. I need a request that will display all the data from all the requests. This request will be executed when the mobile application starts . I found this module:, but I don't know the methods to display all the views with content types that I created. Any solution?


Here is my quick answer.I

Lowell's picture

Here is my quick answer.

I made a page controller (for the endpoint) that gets all nid's, processes them to extract the data I want in my json, and returns the data as a json response.

// get all nid's using $key and $value as db-query conditions
\Drupal::entityQuery('node')->condition($key, $value)->execute()

// return json response
return new JsonResponse($dataArray);

Hope this helps