1

I'm on building a rest view of nodes using Serializer as formatter. This view has a contextual filter on a plain-text field of that content type.

How can I return a 404 error when the contextual filter value is provided in the URL, but the view returns no result?

I've tried various validators, such as content, field, or basic validation, but none of them does what I'm looking for.

1

In the 'No Results Behavior' section for the view, click 'add', and choose 'Response Status Code', and set the value to 404.

1
  • Unfortunately that is not not working because under that section nothing can be added. It is actually stated "The selected display type does not use empty plugins"
    – Giuseppe
    Jul 14 at 8:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.