1

I can see Drupal 8 Views support REST Export.

But not JSON API.

So how to integrate Views with JSON API?

https://www.drupal.org/project/jsonapi

2
  • 6
    You can't. JSON API gives you the same (and more) power to achieve similar results as if using REST+Views. See this comparison
    – theuni
    Jul 25, 2018 at 5:48
  • Is there any alternatives so I can get views in JSON. Last will be custom
    – Mighty
    Jul 25, 2018 at 6:04

3 Answers 3

2

If you want to display the structure of the view as JSON API output you need to get the UUID of the view and then pass it to the json api For example as given below.

http://yoursite/jsonapi/view/view/889120bb-98f2-43be-8ca3-d93d1cd15590

To get the UUID of the view you need to go http://yoursite/jsonapi and scroll to the View portion of the output and then go to the links block. That will list all the views in the site with their UUIDs.

1

Just enable RESTful Web Services and provide REST export in your view.

enter image description here

1
  • 1
    That's core's REST + view. That's not what's asked for.
    – theuni
    Jul 25, 2018 at 9:24
0

/jsonapi/view/view will give you a comprehensive list of all the views.

The data:attributes:drupal_internal__id and data:attributes:label nodes will tell you which view you are looking at in the list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.