It is not possible to filter paragraphs via JSON:API

Created on 29 November 2019, over 4 years ago
Updated 16 April 2024, 2 months ago

When trying to apply a filter to the /jsonapi/paragraph/[paragraph type], you will get an empty set ("data": [])
This is due to the issue explained here: https://www.drupal.org/node/3036792
Please implement a paragraphs_jsonapi_paragraph_filter_access hook to allow filtering.

Something along these lines should do:

use Drupal\Core\Access\AccessResult;

/**
 * Implements hook_jsonapi_paragraph_filter_access().
 */
function paragraphs_jsonapi_paragraph_filter_access(EntityTypeInterface $entity_type, $account) {
  // @see \Drupal\entity_test\EntityTestAccessControlHandler::checkAccess()
  return ([
    JSONAPI_FILTER_AMONG_ALL => AccessResult::allowedIfHasPermission($account, 'bypass paragraphs type content access'),
  ]);
}
🐛 Bug report
Status

Needs review

Version

1.10

Component

Code

Created by

🇫🇮Finland lorenzo_coronati

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024