Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time filters treated as text #13

Closed
aditisg17 opened this issue May 19, 2017 · 1 comment
Closed

Time filters treated as text #13

aditisg17 opened this issue May 19, 2017 · 1 comment

Comments

@aditisg17
Copy link

A filter on time in API calls gives wrong result, as the resultant query takes time as "text" instead of "date"

API Call :
http://localhost:8080/SensorThingsService/v1.0/HistoricalLocations?$filter=(time ge '2017-05-19T10:10:27' and time le '2017-05-19T10:10:28')

Resultant PostgreSQL query:
select "e1"."ID", "e1"."ID", "e1"."TIME", "e1"."THING_ID"
from "HIST_LOCATIONS" "e1"
where "e1"."TIME"::text >= ? and "e1"."TIME"::text <= ?
order by "e1"."ID" asc

historicallocation_datetimequery_issue

@hylkevds
Copy link
Member

Dates in the URL must not be quoted as strings. If you quote them as string, they will be treated as strings.

v1.0/HistoricalLocations?$filter=(time ge 2017-05-19T10:10:27Z and time le 2017-05-19T10:10:28Z)

Don't forget to add the timezone and urlencode!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants