Using Views to provide custom data sources
The RESTful Web Services module provides Views plugins that allow you to expose data over Views for your RESTful API. This allows you to create a view that has a path and outputs data using a serializer plugin. You can use this to output entities, such as JSON, HAL JSON, or XML, and it can be sent with appropriate headers.
In this recipe, we will create a view that outputs the users of the Drupal site, providing their username, e-mail, and picture if provided.
How to do it…
- Visit Extend from the administrative toolbar and install the
Web Services
modules:Serialization
,RESTful Web Services
, andHAL
. - Visit Structure and then Views. Click on Add new view. Name the view
API Users
and have it show Users. - Check ...
Get Drupal 8: Enterprise Web Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.