JSON:API Views Support

Created on 21 July 2024, 4 months ago
Updated 20 September 2024, 2 months ago

Problem/Motivation

Currently the jsonapi client can't easily access jsonapi_views endpoints. To resolve this, either:

* JSON:API Views needs to support hypermedia (see https://www.drupal.org/project/jsonapi_views/issues/3173663 β†’ )
* Or the jsonapi client could add a getView method which would allow a views endpoint to be derived without doing an index lookup.

Both would have value, but I think the client should also allow you to source views without requiring a lookup in the jsonapi index.

Steps to reproduce

* Enable jsonapi_views
* None of our existing methods will allow you to source the exposed view endpoint.

Proposed resolution

A getView method with a signature similar to getCollection

`getCollection(type, options?)`

Type in this case is a view machine name and a display_id. For example:

`getView('articles--page_1')`

This will result in a fetch request being made to `jsonapi/views/articles/page_1`

Remaining tasks

* Implement changes
* Add test coverage
* Update documentation

API changes

* Adds new getView method

✨ Feature request
Status

Fixed

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States brianperry

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024