onesky
July 12, 2020, 9:17pm
1
We are trying to pull existing data using the query sample, but query= with date always returns nothing. We tried a whole bunch of different formats:
https://kc.kobotoolbox.org/api/v1/data/456322?query= {“date”: {“lt$”: “2014-09-29T01:02:03+0000”}}
https://kc.kobotoolbox.org/api/v1/data/456322?query= {“date”: {“gt$”: “2014-09-29T01:02:03+0000”}}
If we remove the query value, everything works.
https://kc.kobotoolbox.org/api/v1/data/456322
We copied the query from the following page:
https://kc.kobotoolbox.org/api/v1/data
What are we doing wrong? Is this feature still supported?
Hi @onesky
Ideally speaking the query should work if the date being referenced is actually named as date in your data based on the reading you had done
query={"date": {"gt$": "2014-09-29T01:02:03+0000"}}'
We however noted that there had been some issues which are clearly discussed in the following forum discussion.
The API documentation at https://kc.kobotoolbox.org/api/v1/data shows an example that filters form submission data by date:
curl -X GET 'https://kc.kobotoolbox.org/api/v1/data/22845?query={"date": {"gt$": "2014-09-29T01:02:03+0000"}}'
Even allowing for the MongoDB documentation stating that the greater than operator is actually $gt rather than gt$, has anyone got this to work?
I can’t retrieve any of my data at all, even using a date 2018-01-01T00:00:00+0000.
Stephane
1 Like