How to implement date filters with operators like = in a JSON query string? We use Drupal 7 and the Service (Version 3) module. First we created a view using a date with a "between operator" as a filter, which works fine. Then we added a service view as .json format inn which we try to pass that date operator in the query string of it, but we cannot get that to work.

The query string we are using looks similar to this example:

http://example.com/drupal/api(endpoint)/sampleview.json?field_invoice_date_value&lt;='2013-12-31'&amp;field_invoice_date_value&gt;='2013-11-31'

To produce the output of the view in json format, we used the (amazing!) Services Views module. We added the service view path to the services resource. As mentioned above, the date filtering is working fine in the view (as confirmed by our testing of the view, without using JSON). But if we try using JSON then the between operator for the date is for unknown reasons not (yet) working.

Below are 5 screenshots to further explain what we're trying to implement (and what we got to work so far).

1. Service View



2. Date filter



3. View output



4. Adding service view as service resource



5. JSON query string variations


  http://web.com/drupal/api[endpoint name]/chart(view service pathname).json?field_invoice_date_value>=2013-11-01&amp;field_invoice_date_value_1&lt;=2013-12-31


The above string is NOT working, note the filter in it like so:


  "field_invoice_date_value>=2013-11-01&amp;field_invoice_date_value_1&lt;=2013-12-31"


Other filters are working correctly, like this one:


  http://web.com/drupal/api[endpoint name]/chart(view service pathname).json?facility_name_value='test'


Since we need the JSON output using that 'between date', we also tried this variation, which is NOT working either:


  http://web.com/drupal/api[endpoint name]/chart(view service pathname).json?field_invoice_date_value='20131210--20131213'


When testing with the string above, we received the following error message too:

"Cannot create references to/from string offsets nor overloaded objects in common.inc on line 6579"

My question: Please let me know how to implement the date between operator in a JSON query string, or any other ideas you have to further debug this issue.
OK, below is what appears to be the solution for it ... We need to pass the query string as follows (all string, sorry for the formatting ...):


  http://web.com/drupal/api[endpoint name]/chart(view service pathname).json?field_invoice_date_value[min][year]=2013&amp;field_invoice_date_value[min][month]=12&amp;field_invoice_date_value[min][day]=1&amp;field_invoice_date_value[max][year]=2014&amp;field_invoice_date_value[max][month]=1&amp;field_invoice_date_value[max][day]=1


Things to notice in what is shown above:


No (more) &lt;= or &gt;= (can't use that in such JSON string).
Use notations like [min][month], [max][day], etc. instead (rather self explaining ... if you know about this syntax of course).


Done, works as designed ...