JSON:API filters are not working on Webform Submissions

Created on 27 May 2024, about 1 month ago
Updated 28 May 2024, about 1 month ago

Problem/Motivation

I'm not sure if this is an issue of JSON:API or Webform itself, but as Webform Submissions are native Drupal entities my first guess would be it is an issue of JSON:API.

If we try to filter submissions, we always get an empty result:

sorted, but unfiltered:

?include=uid&sort[sort-sid][path]=sid&sort[sort-sid][direction]=DESC


{
  "jsonapi": {
    "version": "1.0",
    "meta": {
      "links": {
        "self": {
          "href": "http://jsonapi.org/format/1.0/"
        }
      }
    }
  },
  "data": [
    {
      "type": "webform_submission--langbewerbung",
      "id": "8c350a2a-ece7-4287-921f-575b6896c539",
      "links": {
        "self": {
          "href": "http://dorea-jb.flow.localhost:8012/jsonapi/submissions/langbewerbung/8c350a2a-ece7-4287-921f-575b6896c539"
        }
      },
      "attributes": {
        "serial": 7039,
        "drupal_internal__sid": 16546,
        "token": "LjHA1b4ORwPu8Q4sxBt1vhk5G9CzW1sU-za_qsKgJvA",
        "uri": "/langbewerbung",
        "created": "2024-05-14T10:25:57+00:00",
        "completed": "2024-05-14T10:27:17+00:00",
        "changed": "2024-05-14T10:27:17+00:00",
        "in_draft": false,
        "current_page": null,
        "langcode": "de",
        "entity_type": null,
        "entity_id": null,
        "locked": false,
// ...

sorted and filtered (test)

?include=uid&sort[sort-sid][path]=sid&sort[sort-sid][direction]=DESC&filter[serial]=7039

{
  "jsonapi": {
    "version": "1.0",
    "meta": {
      "links": {
        "self": {
          "href": "http://jsonapi.org/format/1.0/"
        }
      }
    }
  },
  "data": [],
  "links": {
    "self": {
      "href": "http://dorea-jb.flow.localhost:8012/jsonapi/submissions/langbewerbung?filter%5Bserial%5D=7039&include=uid&sort%5Bsort-sid%5D%5Bpath%5D=sid&sort%5Bsort-sid%5D%5Bdirection%5D=DESC"
    }
  }
}

Steps to reproduce

* install json-api extras module
* Enable the submisssions of a webform
* build a filter url for sid as above

Proposed resolution

The filtering should work as for other entities.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

10.2 ✨

Component
JSON APIΒ  β†’

Last updated about 8 hours ago

Created by

πŸ‡©πŸ‡ͺGermany Schoenef Unna

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

Comments & Activities

Production build 0.69.0 2024