I'm trying to find all taxonomy terms, where one field IS NULL via the JSON API.

So I'm testing to retrieve a node via the name and it works without any issues:


Then, I'm trying to use another operator on another field:


And I receive a respone:

403 Client Error: Forbidden for url: /jsonapi/taxonomy_term/place?filter%5Btomatch%5D%5Bcondition%5D%5Bpath%5D=field_geolocation&filter%5Btomatch%5D%5Bcondition%5D%5Boperator%5D=IS%20NULL

Just to see, whether there are any issues with the field, I'm trying via the name (and once more the description) again:


And I receive the same 403.

  • D10.1
  • Field Permissions installed
  • Special role for the API user
  • Switched field permissions off for the geolocation field for testing
  • Checked the JSON output of the successful response for the field name
  • And Python specific, I tried the string 'IS%20NULL' and urllib.parse.quote("IS NULL")

What am I doing wrong?

  • Try uninstalling Field Permissions and see if it works? I just tried your code as an anonymous user on a site of mine (?filter[tomatch][condition][path]=t.value&filter[tomatch][condition][operator]=IS%20NULL) and it returns the null fields as expected, no error. Commented Oct 15, 2023 at 0:15
  • Still the same. I've uninstalled the module on a dev version of the site. Other requests work. Before and after uninstalling (and clearing the cache) I run into the 403.
    – Chris
    Commented Oct 16, 2023 at 1:14
  • How are you testing this? I would try it in the browser first. The IS NULL check on the path field should definitely work, so that's the one I would start with. JSON:API permissions are supposed to be exactly the same as the normal Drupal permissions, so users generally should be able to access the path, and so JSON:API should allow filtering on the path. If you're still getting a 403, it is likely that your API user does not have the correct permissions, so try giving that role more permissions in the admin UI. Commented Oct 16, 2023 at 9:35
  • Now I've tried it via frontend - logged in with the API user, edited a taxonomy term, added the lat/lon and it worked.
    – Chris
    Commented Oct 18, 2023 at 5:44


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.