When working with Views, although a Filter Criteria is exposed to allow users to change values, the user input value is ignored and the default value is always used. This only occurs on Views of type "REST export". For example, the same view parameters will work as expected when the View type is "Page".

Steps required to reproduce the bug:

  1. Standard install of Drupal
  2. Enable the following core modules: RESTful Web Services, Serialization
  3. Create a new view type (/admin/structure/views/add). View settings:
    • "Show Content of type All"
    • Provide a REST export
    • Settings:
      • Path: /[testPath]
      • Add Filter Criteria:
        • Content: Node ID
          • Expose this filter to visitors, to allow them to change it
          • Operator: Is greater than
          • Value: 0
          • Filter identifier: nid
  4. Assuming your site has no content to start, you will need to create a few nodes in order to test the new view (i.e. add content to site)
  5. Test the view:
    • Default (show all nodes): /[testPath]
    • Test Filter (all nodes with nid > 1): /[testPath]?nid=1

Expected behavior:
A list of nodes, excluding node 1 (due to the filter "nid>1")

Instead:
The user input Filter criteria (provided by ?nid=1) is ignored and the default list of all nodes is always returned

Workaround:
Configure the View as type "Page", then the url filter parameters are accepted and the view behaves as expected

Configuration details:

  • Apache Version: 2.2.31
  • Architecture: x86_64
  • Operating System: linux
  • PHP Version: 5.6.11
  • MySQL Version: 5.5.42-37.1-log
  • Drupal Core: drupal 8.0.0-rc2
  • Drupal enabled modules (in addition to standard Drupal install):
    • RESTful Web Services
    • Serialization

Comments

ptwob132 created an issue. See original summary.

khaled.zaidan’s picture

Status: Active » Closed (duplicate)