JSON:API filters are not working on Webform Submissions

Created on 27 May 2024, over 1 year 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 2 months ago

Created by

πŸ‡©πŸ‡ͺGermany Schoenef Unna

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

Comments & Activities

  • Issue created by @Schoenef
  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    COuld you test if this works with filter OR sort? So either one without the other? I suspect the combination.

  • πŸ‡³πŸ‡ΏNew Zealand quietone

    Fixes are made on on 11.x (our main development branch) first, and are then back ported as needed according to our policies. Also, 10.2 is in security mode now.

  • Status changed to Postponed: needs info over 1 year ago
  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands
  • Status changed to Closed: outdated 5 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Since there's been no follow up going to close out. If still a bug in D11 please re-open.

    Thanks all

Production build 0.71.5 2024